#include using namespace std; int main() { int n, k; cin >> n >> k; vector cnt(n + 1); for (int i = 1; i <= n; ++i) { int x; cin >> x; cnt[x]++; } sort(cnt.begin(), cnt.end(), greater()); int ans = 0; for (int i = 0; i <= n; ++i) { if (k >= cnt[i]) ans++, k -= cnt[i]; else if (k) ans++, k = 0; else break; } cout << ans; return 0; }