import java.util.*;
public class Main{
static void findMinimumDistinct(int A[], int N, int K)
{
Map<Integer, Integer> mp = new HashMap<>();
for(int i = 0; i < N; i++)
mp.put(A[i], mp.getOrDefault(A[i], 0) + 1);
int count = 0;
int len = 0;
ArrayList<Integer> counts = new ArrayList<>();
for(Map.Entry<Integer, Integer> i : mp.entrySet())
counts.add(i.getValue());
Collections.sort(counts, (a, b) -> b - a);
for(int i = 0; i < counts.size(); i++)
{
if (len >= K)
break;
len += counts.get(i);
count++;
}
System.out.print(count);
}
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int c= in.nextInt();
in.hasNextInt();
int K = in.nextInt();
int A[] = new int[c];
for(int i=0;i<c;i++){
A[i]=in.nextInt();
}
int N = A.length;
findMinimumDistinct(A, N, K);
}
}