#include #include using namespace std; using namespace atcoder; using ll = long long; int main() { int N, K; cin >> N >> K; map mp; for (int i = 0; i < N; i++) { int a; cin >> a; mp[a]++; } vector vec; for (auto p: mp) { vec.push_back(p.second); } sort(vec.rbegin(), vec.rend()); int ans = 0, sum = 0, i = 0; while (sum < K) { sum += vec[i]; ans++; i++; } cout << ans << endl; return 0; }