#include <bits/stdc++.h>
using namespace std;
const long long maxn = 200005;
const long long inf = 2000000000;
inline long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; }
long long fa[maxn];
bool vis[maxn];
long long Cnt[maxn];
long long pre1[maxn], pre2[maxn];
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, m, x, k, s;
  string str;
  cin >> n >> s;
  for (long long i = 1; i <= n; i++) cin >> fa[i], fa[i];
  long long ans = 0;
  long long canUse = 0;
  if (fa[s] != 0) fa[s] = 0, ans++;
  vis[0] = 1, Cnt[0] = 1;
  sort(fa + 1, fa + 1 + n);
  for (long long i = 2; i <= n; i++) {
    if (fa[i] == 0) canUse++;
  }
  for (long long i = 1; i <= n; i++)
    if (fa[i] == 0)
      continue;
    else
      vis[fa[i]] = 1, Cnt[fa[i]]++;
  pre1[0] = 1;
  for (long long i = 1; i < n; i++) pre1[i] = vis[i] + pre1[i - 1];
  long long tmp = 0;
  long long mn = inf;
  if (n == 1)
    mn = ans;
  else {
    for (long long i = n - 1; i >= 1; i--) {
      tmp = i - pre1[i] + 1;
      mn = min(mn, ans + canUse + max((long long)0, tmp - canUse));
      canUse += Cnt[i];
    }
  }
  cout << mn << endl;
  return 0;
}
