#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, ar[55], i, m, p;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> ar[i];
  m = ar[k - 1];
  if (!m) m = 1;
  sort(ar, ar + n);
  p = lower_bound(ar, ar + n, m) - ar;
  cout << n - p;
  return 0;
}
