""" """ import sys from sys import stdin N,K = map(int,stdin.readline().split()) A = list(map(int,stdin.readline().split())) s = set(A) print (min(len(s),K))