words = input().split()
n = int(input())
print(words[min(n, len(words)) - 1])