s=str(input()) s3=int(input()) stro=s.split() for j in range(len(stro)): if j==s3-1: print(stro[j]) elif s3>len(stro): print(stro[len(stro)-1]) break