#include <bits/stdc++.h>
using namespace std;
int main() {
  int persons, score, tab[1000], qua = 0, clas = 0, sum = 0;
  cin >> persons >> score;
  for (int i = 0; i < persons; i++) {
    cin >> tab[i];
  }
  qua = tab[score - 1];
  for (int j = 0; j < persons; j++) {
    sum += tab[j];
    if (qua == 0) qua = 1;
    if (tab[j] >= qua) clas++;
  }
  if (sum == 0) clas = 0;
  cout << clas;
}
