#include <bits/stdc++.h>
using namespace std;
int main() {
  int numscores, place;
  cin >> numscores >> place;
  int tmp;
  int threshhold = 0;
  int nextroundparts = 0;
  for (int idx = 0; idx < numscores; idx++) {
    cin >> tmp;
    if (idx == place - 1) {
      threshhold = tmp;
    }
    if (tmp >= threshhold && tmp > 0) {
      nextroundparts++;
    }
  }
  cout << nextroundparts;
  return 0;
}
