#include #define int long long using namespace std; int t; void solve() { int n,k; scanf("%lld%lld",&n,&k); map mp; for (int i = 0; i < n; i ++) { int x; scanf("%lld",&x); mp[x] ++; } vector v; for (auto c:mp) { v.push_back(c.second); } sort(v.begin(),v.end(),greater()); int now = 0; for (int i = 0; i < (int)v.size(); i ++) { now += v[i]; if(now >= k) { printf("%lld\n",i + 1); break; } } } signed main() { t = 1; while(t --) { solve(); } return 0; }