#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
string str;
string strcop;
while(getline(cin,str))
{
vector <string> vecstr;
int num;
istringstream ss(str);
while(ss>>strcop)
{
vecstr.push_back(strcop);
}
cin>>num;
reverse(vecstr.begin(), vecstr.end());
cout<<vecstr[num-1]<<endl;
vector<string>().swap(vecstr);
}
return 0;
}