#include <bits/stdc++.h>
using namespace std;
int a[212345];
int main() {
  std::ios::sync_with_stdio(false);
  int n, s;
  cin >> n >> s;
  s--;
  int i, j, haha = 0, filler = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (a[s] != 0) {
    haha++;
    a[s] = 0;
  }
  for (i = 0; i < n; i++) {
    if (a[i] == 0) {
      filler++;
      haha++;
    }
  }
  haha--;
  filler--;
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    if (a[i] != 0) break;
  }
  j = n - 1;
  int prev = 0;
  while (i <= j) {
    if (a[i] != prev + 1 && a[i] != prev) {
      if (filler) {
        filler--;
        prev++;
      } else {
        j--;
        prev++;
        haha++;
      }
    } else {
      prev = a[i];
      i++;
    }
  }
  cout << haha << endl;
}
