from collections import Counter def main(): n, k = map(int, input().split()) p = list(map(int, input().split())) c = Counter(p).most_common() c.sort(key=lambda x: x[0], reverse=True) ans = 0 for _, v in c: if ans + v > k: exit(print(ans)) else: ans += v print(n) if __name__ == "__main__": main()