#include #include using namespace std; using namespace atcoder; using ll = long long; #define rep(i,a,b) for(int i = a; i < b; ++i) #define rrep(i,a,b) for(int i = a; i >= b; --i) #define all(x) (x).begin(),(x).end() const int MOD = 998244353; int main(){ int n, k; cin >> n >> k; vector a(n); rep(i,0,n) cin >> a[i]; sort(all(a)); set st; rep(i,0,k){ st.insert(a[i]); } cout << st.size() << endl; return 0; }