1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <algorithm>
#include <iostream>
using namespace std;
int a[2005];
int cmp(int x, int y) { return x > y; }
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1, cmp);
  for (int i = k;; i++)
    if (a[i] != a[i + 1]) {
      cout << i << endl;
      return 0;
    }
}