#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  --k;
  vector<int> a;
  a.reserve(n);
  for (int i = 0; i < n; ++i) {
    int a_i;
    cin >> a_i;
    a.push_back(a_i);
  }
  int k_score = *(a.begin() + k);
  if (k_score > 0) {
    cout << a.rend() - lower_bound(a.rbegin(), a.rend(), k_score);
  } else {
    cout << a.rend() - upper_bound(a.rbegin(), a.rend(), k_score);
  }
  return 0;
}
