N = input()
M = int(input())
N = N.split()
if M < len(N):
    print(N[M-1])
else:
    print(N[-1])