#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
int cnt[(int)(2e5 + 5)], pref[(int)(2e5 + 5)];
void solve() {
  int n, mx = 0, ans = 0, s;
  scanf("%d", &n);
  scanf("%d", &s);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (i == s) {
      if (x != 0) {
        x = 0;
        ans++;
      }
    }
    cnt[x]++;
    mx = max(mx, x);
  }
  if (n == 1) {
    if (mx == 0) {
      printf("%d", 0);
    } else {
      printf("%d", 1);
    }
    return;
  }
  pref[0] = cnt[0];
  for (int i = 1; i <= n - 1; i++) {
    pref[i] = pref[i - 1] + cnt[i];
  }
  int n_todo = 0, invalid_ext = cnt[0] - 1,
      finans = ans + invalid_ext + pref[n - 1] - pref[0];
  for (int i = 1; i <= n - 1; i++) {
    if (!cnt[i]) {
      n_todo++;
      if (invalid_ext) {
        n_todo--;
        ans++;
        invalid_ext--;
      }
    }
    if (invalid_ext >= n_todo) {
      invalid_ext -= n_todo;
      ans += n_todo;
    } else {
      n_todo -= invalid_ext;
      ans += invalid_ext;
      invalid_ext = 0;
    }
    finans =
        min(finans, ans + invalid_ext + max(n_todo, pref[n - 1] - pref[i]));
  }
  printf("%d", finans);
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
