#include <bits/stdc++.h>
using namespace std;
int main() {
  int ara[100];
  int i, n, k, x = 0;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> ara[i];
  for (i = 1; i <= n; i++) {
    if (ara[i] >= ara[k] && ara[i] > 0) x++;
  }
  cout << x << endl;
}
