#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, N = 0;
  cin >> n >> k;
  int A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n; i++) {
    if (A[i] >= A[k - 1] && A[i] > 0) N += 1;
  }
  cout << N;
  return 0;
}
