#include #include #include #include #include #include #include #include #include #include #include using namespace::std; int main() { ios::sync_with_stdio(false); int n, k; cin >> n >> k; unordered_map c; for (int i = 0; i < n; ++i) { int a; cin >> a; ++c[a]; } vector b; for (const auto& [_, cx] : c) b.push_back(cx); sort(b.begin(), b.end(), greater()); int r = 0; for (; k > 0; ++r) k -= b[r]; cout << r << endl; return 0; }