#include <bits/stdc++.h>
using namespace std;
const int K = 200005;
int n, s, a[K], b[K], c[K], k, t, x, fp = K;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (i != s && !a[i]) ++t;
    ++b[a[i]];
  }
  if (n == 1) {
    if (a[1] == 0)
      cout << 0 << endl;
    else
      cout << 1 << endl;
    return 0;
  }
  if (a[s]) k = 1, --b[a[s]], ++b[0], a[s] = 0, c[0] = 1;
  for (int i = 1; i <= n; ++i) {
    c[i] = c[i - 1];
    if (!b[i]) ++c[i];
  }
  x = n - b[0] + t + k;
  for (int i = 1; i < n; ++i) {
    x -= b[i];
    fp = min(fp, x + max(c[i] - x, 0));
  }
  cout << fp << endl;
  return 0;
}
