#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n >> s;
  s--;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); i++) {
    scanf("%d", &a[i]);
  }
  int base = 0;
  if (a[s] != 0) {
    a[s] = 0;
    base++;
  }
  if (n == 1) {
    cout << base << endl;
    return 0;
  }
  int ans = n;
  vector<int> c(n);
  for (int i = 0; i < (int)(n); i++) {
    c[a[i]]++;
  }
  int holes = 0;
  int sum = c[0];
  for (int k = 1; k < n; k++) {
    if (c[k] == 0) holes++;
    sum += c[k];
    int wrong = c[0] - 1 + n - sum;
    ans = min(ans, base + max(wrong, holes));
  }
  cout << ans << endl;
  return 0;
}
