to hai2k9
program abc;
uses crt;
var n,k : longint;
i : longint;
a : array[1..100000] of longint;
dem : array[-1000000..1000000] of longint;
res : longint;
min,max : longint;
BEGIN
clrscr;
readln(n,k);
for i := 1 to n do read(a[i]);
fillchar(dem, sizeof(dem), 0);
max := a[1];
min := a[1];
for i := 1 to n do
begin
dem[a[i]] := dem[a[i]] +1;
if (max < a[i]) then max := a[i];
if (min > a[i]) then min := a[i];
end;
res := 0;
for i := min to max do
if dem[i] > k then res := res +1;
write(res);
END.