#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, s, cnt[N], ps[N], fre, base;
int main() {
  cin >> n >> s;
  s--;
  fill(cnt + 1, cnt + n + 1, 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i == s && x != 0) {
      base++;
      continue;
    }
    if (i != s && x == 0) fre++;
    cnt[x] = 0;
    ps[x]++;
  }
  if (n == 1) {
    cout << base;
    return 0;
  }
  for (int i = n - 1; i >= 0; i--) ps[i] += ps[i + 1];
  int nd = 0, rtr = 1e9;
  for (int i = 1; i < n; i++) {
    nd += cnt[i];
    if (nd <= fre + ps[i + 1])
      rtr = min(rtr, fre + ps[i + 1] + base);
    else
      rtr = min(rtr, nd + base);
  }
  cout << rtr;
  return 0;
}
