#include "bits/stdc++.h" using namespace std; #define int long long using ll = long long; using P = pair; const ll INF = (1LL << 61); ll mod = (ll)1e9 + 7; signed main() { ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vectorp(N); for (int i = 0; i < N; i++)cin >> p[i]; int ans = 0; for (int i = 0; i <= 400; i++) { int cnt = 0; for (int j = 0; j < N; j++) { if (p[j] >= i)cnt++; } if (cnt <= K)ans = max(ans, cnt); } cout << ans << endl; return 0; }