#include <bits/stdc++.h>
const int INF = ~0u >> 2;
const int MAXN = 400001;
int n, r, d[MAXN];
int main() {
  scanf("%d%d", &n, &r);
  for (int i = 1; i <= n; i++) {
    scanf("%d", d + i);
    if (i != r && d[i] == 0) d[i] = INF;
  }
  int answer = 0;
  if (d[r] != 0) {
    answer++;
    d[r] = 0;
  }
  std::sort(d + 1, d + n + 1);
  for (int depth = 0, l = 1, r = n; depth < n; depth++) {
    if (l > r) break;
    bool flag = false;
    while (l <= r && depth == d[l]) {
      l++;
      flag = true;
    }
    if (!flag) {
      answer++;
      r--;
    }
  }
  printf("%d\n", answer);
}
