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