#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { ll n, k; cin >> n >> k; vector a(n), b(n); for (int i = 0; i < n; i++){ ll tmp; cin >> tmp; a[tmp-1]++; } sort(a.begin(), a.end(), greater()); for (int i = 0; i < n; i++){ if (i == 0) b[0] = a[0]; else b[i] += b[i-1] + a[i]; if (b[i] >= k) { cout << i + 1 << endl; return 0; } } }