#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
using namespace std;
char strings[2005][2005];
char tmp[2005];
int n,k,i,j;
int main()
{
cin>>n>>k;
for (i=1;i<=n;i++) cin>>strings[i];
for (i=1;i<=n-1;i++)
{
for(j=i+1;j<=n;j++)
{
if (strcmp(strings[i],strings[j])>0)
{
strcpy(tmp,strings[i]);
strcpy(strings[i],strings[j]);
strcpy(strings[j],tmp);
}
}
}
cout<<strings[k];
return 0;
}