#include <bits/stdc++.h>
const int maxn = 200000 + 10;
int a[maxn], cnt[maxn];
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  int ans = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (a[s] != 0) {
    a[s] = 0;
    ans++;
  }
  for (int i = 1; i <= n; i++) cnt[a[i]]++;
  ans += cnt[0] - 1;
  int l = 1, r = n;
  while (l < r) {
    if (cnt[l] == 0) {
      if (cnt[0] >= 2)
        cnt[0]--;
      else {
        while (l < r && cnt[r] == 0) r--;
        if (cnt[r] >= 1) {
          cnt[r]--;
          ans++;
        }
      }
    }
    l++;
  }
  printf("%d\n", ans);
  return 0;
}
