#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int n, k; cin >> n >> k;
	vector<int>res(200005, 0);
	for (int i = 0, tmp; i < n; i++) {
		cin >> tmp; res[tmp]++;
	}
	sort(res.rbegin(), res.rend());
	int ans = 0;
	for (int i = k; i < 200005; i++)ans += res[i];
	cout << ans << endl;
	return 0;
}