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