while True:
    try:
        input()
    except EOFError:
            break
    li = input().split()
    i = int(input())
    print(li[-i] if i else 0)