#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n >> s;
  s--;
  int pre = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  if (a[s] != 0) a[s] = 0, pre++;
  if (n == 1) {
    cout << pre << endl;
    return 0;
  }
  vector<int> cnt(n);
  for (int i = 0; i < n; i++) cnt[a[i]]++;
  for (int i = 1; i < n; i++) {
    if (cnt[i] == 0 && cnt[0] > 1) {
      cnt[i]++;
      cnt[0]--;
      pre++;
    }
  }
  vector<int> zero(n);
  vector<int> sum(n);
  sum[0] = 1;
  for (int i = 1; i < n; i++) {
    zero[i] = zero[i - 1] + (cnt[i] == 0);
    sum[i] = sum[i - 1] + cnt[i];
  }
  int ans = INT_MAX;
  for (int i = 1; i < n; i++) {
    int back = n - sum[i];
    int z = max(0, zero[i] - back);
    int nz = (i + 1) - zero[i];
    if (z > sum[i] - nz) continue;
    int cand = back + z;
    ans = min(ans, cand + pre);
  }
  cout << ans << endl;
}
