1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <bits/stdc++.h>
using namespace std;

const int N = 2000;

int x[N];

int main() {
  int n, k; cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> x[i];
  sort(x, x + n, greater<>());
  while (k < n && x[k - 1] == x[k]) ++k;
  cout << k << '\n';
  return 0;
}