#include <bits/stdc++.h>
using namespace std;
bool comp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first > b.first;
}
int main() {
  int n, k;
  cin >> n >> k;
  pair<int, int> arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  sort(arr, arr + n, comp);
  vector<int> v(1);
  int cnt = 0;
  v[0] = 1;
  for (int i = 1; i < n; i++) {
    if (arr[i].first == arr[i - 1].first && arr[i].second == arr[i - 1].second)
      v[cnt]++;
    else {
      v.push_back(1);
      cnt++;
    }
  }
  int a = 0;
  for (int i = 0; i < v.size(); i++) {
    a += v[i];
    if (a >= k) {
      cout << v[i] << endl;
      break;
    }
  }
}
