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