#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
int main(){
int n,k,cnt = 0,ans = 0;
cin >> n >> k;
for(int i = 1;i <= n;i++) cin >> a[i];
for(int i = 1;i <= n;i++){
cnt = 0;
for(int j = 1;j <= n;j++){
if(a[j] > a[i]) cnt++;
}
if(cnt <= k) ans++;
}
cout << ans;
return 0;
}