1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <cstdio>
#include <cstring>

#define MAX_A 120

int main ()
{
  int T [MAX_A+1], n, k, a, m = MAX_A, r = 0;
  memset (T, 0, sizeof (T));
  scanf ("%i%i", &n, &k);
  for (int i=0; i<n; i++)
  {
    scanf ("%i", &a);
    T [a]++;
  }
  while (r<k && m>0) r += T [m--];
  printf ("%i\n", r);
  return 0;
}