#include <bits/stdc++.h>
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int A[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] >= A[k - 1] && A[i] != 0) {
      c++;
    }
  }
  printf("%d", c);
}
