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