#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
int cnt[N], a[N], sum[N], n, s;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  for (int i = 1; i <= n; ++i) cin >> a[i];
  int add = 0;
  if (a[s] != 0) ++add;
  a[s] = 0;
  for (int i = 1; i <= n; ++i) ++cnt[a[i]];
  sum[0] = cnt[0];
  for (int i = 1; i <= n; ++i) sum[i] = sum[i - 1] + cnt[i];
  int ans = 1e9;
  int num = 0;
  for (int i = 1; i < n; ++i) {
    if (!cnt[i]) ++num;
    int need = num;
    int can = min(num, sum[n] - sum[i] + cnt[0] - 1);
    need -= can;
    ans = min(ans, n - (sum[i] - (sum[0] - 1) - need));
  }
  cout << ans + add;
  return 0;
}
