#include <bits/stdc++.h>
using namespace std;
const int nmax = 200;
struct team {
  int p, t;
} t[nmax];
int n, k;
inline bool cmp(team a, team b) {
  if (a.p < b.p) return false;
  if (a.p > b.p) return true;
  return a.t < b.t;
}
int main() {
  cin >> n >> k;
  for (int i = (1), _b = (n); i <= _b; ++i) cin >> t[i].p >> t[i].t;
  sort(t + 1, t + n + 1, cmp);
  for (int st = 1, en = 1; st <= n; st = en + 1) {
    while (en < n && t[st].p == t[en + 1].p && t[st].t == t[en + 1].t) ++en;
    if (st <= k && k <= en) {
      cout << en - st + 1 << endl;
      break;
    }
  }
  return 0;
}
