#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a;
  int count = 0;
  int boundary;
  int aaray[n];
  for (int x = 1; x < n + 1; x++) {
    cin >> a;
    if (x == k) {
      boundary = a;
    }
    aaray[x - 1] = a;
  }
  for (int element : aaray) {
    if (element >= boundary && element > 0) {
      count++;
    }
  }
  cout << count;
}
