#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n >> s;
  int v[n];
  bool c[n];
  bool q = false;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    c[i] = 0;
    if (i == s - 1) q = v[i] != 0, v[i] = 0;
    if (v[i] == 0 && i != s - 1) v[i] = 1000000001;
  }
  for (int i = 0; i < n; i++) {
    if (v[i] != 1000000001) c[v[i]] = 1;
  }
  if (n == 1) {
    cout << q << endl;
    return 0;
  }
  sort(v, v + n);
  int ans = 1000000001;
  int i = 0;
  int f = 0;
  int d = 0;
  for (int h = 1; h < n; h++) {
    if (!c[h]) f++;
    while (i != n - 1 && v[i + 1] <= h) i++, d += v[i] == v[i - 1];
    if (f <= d + n - (i + 1)) ans = min(ans, max(f, n - (i + 1)));
  }
  cout << ans + q << endl;
}
