#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 5;
int n, s, a[N], sum[N];
int vis[N], empty[N];
int main() {
  scanf("%d%d", &n, &s);
  s--;
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    a[i]++;
  }
  int ans = 0;
  if (a[s] != 1) {
    ans++;
    a[s] = 1;
  }
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) vis[a[i]]++;
  sum[0] = empty[0] = 0;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + vis[i];
    empty[i] = empty[i - 1];
    if (!vis[i]) empty[i]++;
  }
  if (n == 1) {
    printf("%d\n", ans);
    return 0;
  }
  int mn = n;
  for (int i = 2; i <= n; i++) {
    int x = empty[i];
    int y = vis[1] - 1 + sum[n] - sum[i];
    mn = min(mn, max(y, x));
  }
  ans += mn;
  printf("%d\n", ans);
  return 0;
}
