#include using namespace std; int main(){ int N, K; cin >> N >> K; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; A[i]--; } vector B(N, 0); for (int i = 0; i < N; i++){ B[A[i]]++; } vector C(N + 1, 0); for (int i = 0; i < N; i++){ C[B[i]]++; } int ans = 0; for (int i = N; i >= 1; i--){ for (int j = 0; j < C[i]; j++){ if (K > 0){ K -= i; ans++; } } } cout << ans << endl; }