#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long Count, Value, NOW = 0;
  cin >> Count >> Value;
  int* Array = new int[Count];
  for (int i = 0; i < Count; i++) cin >> Array[i];
  for (int z = 0; z < Count; z++)
    if (Array[z] >= Array[Value - 1] && Array[z] > 0) NOW++;
  cout << NOW;
  return 0;
}
