#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int k, n, ans=0;
pair <int, int> p[55];
scanf("%d%d", &n, &k);
for(int i=0; i<n; i++) scanf("%d%d", &p[i].first, &p[i].second), p[i].first*=-1;
sort(p, p+n);
for(int i=0; i<n; i++) if(p[i]==p[k-1]) ans++;
printf("%d", ans);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgaywgbiwgYW5zPTA7CglwYWlyIDxpbnQsIGludD4gcFs1NV07CglzY2FuZigiJWQlZCIsICZuLCAmayk7Cglmb3IoaW50IGk9MDsgaTxuOyBpKyspIHNjYW5mKCIlZCVkIiwgJnBbaV0uZmlyc3QsICZwW2ldLnNlY29uZCksIHBbaV0uZmlyc3QqPS0xOwoJc29ydChwLCBwK24pOwoJZm9yKGludCBpPTA7IGk8bjsgaSsrKSBpZihwW2ldPT1wW2stMV0pIGFucysrOwoJcHJpbnRmKCIlZCIsIGFucyk7CglyZXR1cm4gMDsKfQ==