while True:
    try:
        n = int(input())
        s = list(map(int,input().split()))
        k = int(input())
        if k == 0:
            print(0)
        else:
            try:
                print(s[-k])
            except:
                print(0)
    except:
        break