#include <bits/stdc++.h>
int main() {
  int x, m, i, count;
  count = 0;
  scanf("%d", &x);
  scanf("%d", &m);
  int a[x];
  for (i = 0; i < x; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < x; i++) {
    if (a[i] >= a[m - 1] && a[i] > 0) count++;
  }
  printf("%d", count);
  return 0;
}
