##Pyke (commit 31), 10 9 bytes
Pyke (commit 31), 10 9 bytes
=blR.fbtp
Explanation:
=b - set characters for base conversion to eval_or_not(input())
l - len(^)
R - [^, eval_or_not(input()]
.f - first_n(^)
b - conv_base(^)
t - ^[-1]
p - print(^)