#include #include using namespace std; using namespace std; using ll = long long; #define reps(i, a, n) for(ll i = (a); i < (ll)(n); ++i) #define rep(i,n) reps(i,0,n) #define all(a) (a).begin(), (a).end() //なんかstd::vectorの挙動を修正できるやつ /* alias */ using ull = unsigned long long; using ll = long long; using vi = vector; using vl = vector; using vll = vector; using vvi = vector; using vvl = vector; using vvll = vector; using vs = vector; using pii = pair; int main(){ int n, k; cin >> n >> k; vi a(n); rep(i,n) cin >> a[i]; sort(all(a)); int dist = 0; rep(i,n){ auto it = upper_bound(all(a), a[i]); dist += distance(a.begin()+i, it); if(dist >= k) { cout << i+1 << endl; return 0; } } a.erase(unique(all(a)), a.end()); cout << a.size() << endl; }