#include #include using namespace std; using ll = long long; const int INF = 100100100; int main(){ int n , k; cin >> n >> k; vector table(1000 , 0); for(int i = 0; i < n; i++){ int p; cin >> p; table[p]++; } int ans = 0; for(int i = 999; i >= 0; i--){ if(ans + table[i] > k)break; ans += table[i]; } cout << ans << endl; return 0; }