#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
int a[maxn];
int f[maxn];
int miss[maxn];
int sum[maxn];
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int ans1 = 0;
  if (a[s] != 0) {
    ans1++;
    a[s] = 0;
  }
  int zero = 0;
  for (int i = 1; i <= n; i++) {
    f[a[i]]++;
    if (a[i] == 0) {
      zero++;
    }
  }
  zero--;
  int i = 0;
  while (zero--) {
    while (f[i] != 0) {
      i++;
    }
    f[0]--;
    f[i]++;
    ans1++;
  }
  sum[0] = 1;
  for (int i = 1; i < n; i++) {
    if (f[i] == 0) {
      miss[i] = miss[i - 1] + 1;
    } else {
      miss[i] = miss[i - 1];
    }
    sum[i] = sum[i - 1] + f[i];
  }
  int ans2 = 1e9;
  for (int i = n - 1; i >= 1; i--) {
    int tmp = max((n - sum[i]), miss[i]);
    ans2 = min(ans2, tmp);
  }
  if (n == 1) {
    ans2 = 0;
  }
  cout << ans1 + ans2 << endl;
  return 0;
}
