#include <bits/stdc++.h>
const double PI = acos(-1.0);
const double e = exp(1.0);
const int INF = 0x7fffffff;
;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
inline T Min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline T Max(T a, T b) {
  return a > b ? a : b;
}
bool cmpbig(int a, int b) { return a > b; }
bool cmpsmall(int a, int b) { return a < b; }
using namespace std;
pair<int, int> a[60];
bool cmp(pair<int, int> x, pair<int, int> y) {
  if (x.first != y.first) return x.first > y.first;
  if (x.first == y.first) return x.second < y.second;
}
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 0; i < n; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      a[i] = make_pair(u, v);
    }
    sort(a, a + n, cmp);
    int cnt = 1;
    int nowl, nowr, now = k - 1;
    nowl = now - 1;
    nowr = now + 1;
    while (1) {
      if ((nowl < 0 || (a[nowl].first != a[nowl + 1].first ||
                        a[nowl].second != a[nowl + 1].second)) &&
          (nowr >= n || (a[nowr].first != a[nowr - 1].first ||
                         a[nowr].second != a[nowr - 1].second)))
        break;
      if (nowl >= 0 && (a[nowl].first == a[nowl + 1].first &&
                        a[nowl].second == a[nowl + 1].second)) {
        cnt++;
        nowl--;
      }
      if (nowr < n && (a[nowr].first == a[nowr - 1].first &&
                       a[nowr].second == a[nowr - 1].second)) {
        cnt++;
        nowr++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
