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