n, k = list(map(int, input().split())) s = list(map(int, input().split())) new_s = s[:k] new_s = set(new_s) if n == 0: print(0) else: print(len(new_s))