#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, num;
  cin >> n >> k;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> num;
    a.push_back(num);
  }
  num = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] >= a[k - 1] && a[i] != 0) num++;
  }
  cout << num << endl;
  return 0;
}
