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