# https://www.codeeval.com/open_challenges/10/

import sys

for line in open(sys.argv[1], 'r'):
    if line in ['\n', '\r\n']:
        continue
    
    elements = line.rstrip().split(' ')
    M = int(elements.pop())
    if len(elements) >= M:
        print elements[-M]

ec410508c535e65889fbb7aa25db6eca3e3021ea
# https://www.codeeval.com/open_challenges/10/

import sys

for line in open(sys.argv[1], 'r'):
    if line in ['\n', '\r\n']:
        continue
    
    elements = line.rstrip().split(' ')
    M = int(elements.pop())
    if len(elements) >= M:
        print elements[-M]
