n, k = [int(i) for i in input().split()]
scores = []
for _ in range(n):
p,t = [int(i) for i in input().split()]
scores.append([p,t])
scores.sort(key= lambda x: x[1])
scores.sort(key = lambda x: x[0], reverse=True)
res = 0
for i in scores:
if i == scores[k-1]:
res +=1
print(res)
///Bismillahir Rahmanir Rahim
///In the name of Allah
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define endl '\n'
/*
bool cmp( const pair<int, int> &p1, const pair<int, int> &p2)
{
if(p1.first>p2.first) return 1;
else if(p1.first == p2.first) return (p1.second<p2.second);
return 0;
} */
int main()
{
optimize();
int n,k;
cin>>n>>k;
vector<pair<int, int>>v(n);
for(int i=0;i<n;i++)
{
cin>>v[i].first>>v[i].second;
v[i].first*=(-1); //without comparator
}
sort(v.begin(), v.end()); //without comparator
int ans=0;
for(auto u : v)
{
if(u==v[k-1]) ans++;
}
cout<<ans<<endl;
return 0;
}
1422C - Bargain | 1611F - ATM and Students |
660A - Co-prime Array | 1692F - 3SUM |
1470A - Strange Birthday Party | 190D - Non-Secret Cypher |
1721B - Deadly Laser | 1721C - Min-Max Array Transformation |
1721A - Image | 1180C - Valeriy and Deque |
557A - Ilya and Diplomas | 1037D - Valid BFS |
1144F - Graph Without Long Directed Paths | 1228A - Distinct Digits |
355B - Vasya and Public Transport | 1230A - Dawid and Bags of Candies |
1530A - Binary Decimal | 1472D - Even-Odd Game |
441C - Valera and Tubes | 1328E - Tree Queries |
265A - Colorful Stones (Simplified Edition) | 296A - Yaroslav and Permutations |
967B - Watering System | 152A - Marks |
1398A - Bad Triangle | 137A - Postcards and photos |
1674D - A-B-C Sort | 334A - Candy Bags |
855A - Tom Riddle's Diary | 1417A - Copy-paste |