#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> a;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  int cou = 0, x = 0;
  for (int i = 0; i < n; i++) {
    int foo;
    cin >> foo;
    if (i == k - 1) x = foo;
    if (foo > 0 && foo >= x) cou++;
  }
  cout << cou;
  return 0;
}
