#include void merge_sort(int n, int x[]) { static int y[100001] = {}; if (n <= 1) return; merge_sort(n / 2, &(x[0])); merge_sort((n + 1) / 2, &(x[n/2])); int i, p, q; for (i = 0, p = 0, q = n / 2; i < n; i++) { if (p >= n / 2) y[i] = x[q++]; else if (q >= n) y[i] = x[p++]; else y[i] = (x[p] < x[q])? x[p++]: x[q++]; } for (i = 0; i < n; i++) x[i] = y[i]; } int main() { int i, N, K, A, num[100001] = {}; scanf("%d %d", &N, &K); for (i = 1; i <= N; i++) { scanf("%d", &A); num[A-1]++; } merge_sort(N, num); for (i = N - 1; K > 0; i--) { K -= num[i]; if (K <= 0) break; } printf("%d\n", N - i); fflush(stdout); return 0; }