#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int inf = (int)(1e9);
const double eps = 1e-9;
const int N = 100005;
int n, k;
pair<int, int> a[N];
bool f(pair<int, int> a, pair<int, int> b) {
  return (a.first > b.first || ((a.first == b.first) && (a.second < b.second)));
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;
  sort(a, a + n, f);
  k--;
  int i = 0;
  while (i < n) {
    int ind = i;
    while (i < n - 1 && a[i] == a[i + 1]) {
      ++i;
    }
    if (k >= ind && k <= i) {
      cout << i - ind + 1 << endl;
      return 0;
    }
    ++i;
  }
  return 0;
}
