#include using namespace std; using ll = long long; int cnt[405]; int main(){ int n, k; cin >> n >> k; vector p(n); for(int i = 0; i < n; i++) cin >> p[i]; sort(p.begin(), p.end()); reverse(p.begin(), p.end()); for(int i = 0; i < n; i++) cnt[p[i]]++; int now = 0; int ans = 0; for(int i = 400; i>=0; i--){ now += cnt[i]; if(now>k){ ans = now-cnt[i]; break; } } cout << ans << endl; return 0; }