n, k = list(map(int, input().split())) s = list(map(int, input().split())) count = 1 new_s = s[:k+1] new_s = set(new_s) print(len(new_s))