p,k=map(int,input().split())
lst=list(map(int,input().split()))
lst=sorted(lst)
n=0
num=0
countx=0
county=0
while k>n:
if lst[num]>p:
n+=1
num+=1
countx+=1
elif lst[num]<p:
n+=1
num+=1
county+=1
if countx>county:
print(countx,lst[k-1])
elif countx<county:
print(county,lst[0])