#include using namespace std; int main(){ int n,k; cin >> n >> k; map m; for(int i = 0;i < n;i++){ int a; cin >> a; m[a]++; } vector b; for(auto [key,value] : m){ b.push_back(value); } sort(b.begin(),b.end()); int s = (int)b.size() - 1; int ans = 0; while(k){ k -= b[s]; s--; ans++; } cout << ans << endl; }