#include<bits/stdc++.h>
using namespace std;
int xuehao[505];
double chengji[505];

int main() {
	int n,pm;
	cin>>n>>pm;
	for(int i=1; i<=n; i++) cin>>xuehao[i]>>chengji[i];

	for(int i=1; i<=n; i++) {
		int k=i;
		for(int j=i; j<=n; j++)  {
			if(chengji[j]>chengji[k]) {
				k=j;
			} 
		}
		swap(chengji[i],chengji[k]);
		swap(xuehao[i],xuehao[k]);
	}
	cout<<xuehao[pm]<<' '<<chengji[pm];
	return 0;
}