a = input() n = int(input()) b = a.split() if len(b) > n: print(b[n-1]) else: print(b[len(b)-1])