#include #include using namespace atcoder; using namespace std; using ll=long long; using ld=long double; ll mod=998244353; ll inf=1000000000000000000; int main(){ ll n,k; cin >> n >> k; vectorp(n); for (ll i = 0; i < n; i++) { cin >> p[i]; } ll ans=0; for (ll i = 0; i < n; i++) { ll now=0; for (ll j = 0; j < n; j++) { if (p[j]>=p[i]) { now++; } } if (now<=k) { ans=max(ans,now); } } cout << ans << endl; }