#include <bits/stdc++.h>
using namespace std;
int ara[200005];
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &ara[i]);
  deque<int> dq;
  int res = (ara[s] != 0);
  for (int i = 1; i <= n; i++)
    if (ara[i] && i != s) dq.push_back(ara[i]);
  sort(dq.begin(), dq.end());
  for (int i = 1; i <= n; i++)
    if (!ara[i] && i != s) dq.push_back(INT_MAX);
  int need = 1;
  while (!dq.empty()) {
    if (dq.front() > need)
      res++, need++, dq.pop_back();
    else if (dq.front() < need)
      dq.pop_front();
    else
      need++, dq.pop_front();
  }
  printf("%d\n", res);
  return 0;
}
