#include <bits/stdc++.h>
#pragma warning(disable : 4996)
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int cnt = 0, a[100];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] >= a[k - 1] && a[i] > 0) cnt++;
  }
  printf("%d", cnt);
  return 0;
}
