a=input()
n=int(input())
b=1
c=[]
d=0
e=0
f=1
for i in a:
    if i==" ":
        b+=1
    if b==n:
        c.append(i)