import collections N, K = map(int, input().split()) A = list(map(int, input().split())) Ac = collections.Counter(A) ans = 0 num = 0 for v, c in Ac.items(): num += c ans += 1 if K <= num: print(ans) exit()