#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, k;
  map<pair<long long int, long long int>, long long int> m;
  cin >> n >> k;
  for (long long int i = 0; i < (n); i++) {
    long long int p, t;
    cin >> p >> t;
    m[make_pair(-p, t)]++;
  }
  long long int place = 0, curr = 0, ans;
  for (auto x : m) {
    curr = x.second;
    if (place + curr >= k) {
      ans = curr;
      break;
    }
    place += curr;
  }
  cout << ans;
}
