#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  while (cin >> n >> k) {
    int c = 0;
    int *p = new int[50];
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int j = 0; j < n; j++) {
      if (p[j] > 0) {
        if (p[j] > p[k - 1] || p[j] == p[k - 1]) c++;
      }
    }
    cout << c << endl;
  }
  return 0;
}
