#include<stdio.h>
#include<math.h>
int a[51];
int swap(int n,int m)
{
int t;
t=a[n];
a[n]=a[m];
a[m]=t;
return 0;
}
int qs(int l,int r)
{
int i,j,x;
if (l<r)
{
i=l;
j=r;
x=a[i];
while(i<j)
{
while(i<j&&a[j]>x)j--;
if(i<j)a[i++]=a[j];
while(i<j&&a[i]<x)i++;
if(i<j)a[j--]=a[i];
}
a[i]=x;
qs(l,i-1);
qs(i+1,r);
}
}
int main()
{
int n,k,m,i,j;
scanf("%d %d",&n,&k);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
if(n-k+1<=0||n-k+1>n)printf("-1");
else
{
qs(1,n);
printf("%d 0",a[n-k+1]);
}
return 0;
}
http://codeforces.com/contest/263/problem/B