#include <bits/stdc++.h>
using namespace std;
inline int setBit(int N, int pos) { return N = N | (1 << pos); }
inline int resetBit(int N, int pos) { return N = N & ~(1 << pos); }
inline bool checkBit(int N, int pos) { return (bool)(N & (1 << pos)); }
const int MAX = 200005;
int n, s, arr[MAX], must, freq[MAX], zero[MAX], extra[MAX], wow;
int main() {
  int i, ans = INT_MAX;
  scanf("%d %d", &n, &s);
  s--;
  for (i = 0; i < n; i++) scanf("%d", &arr[i]);
  if (n == 1) {
    if (arr[0] == 0)
      puts("0");
    else
      puts("1");
    return 0;
  }
  if (arr[s] != 0) {
    arr[s] = 0;
    wow++;
  }
  for (i = 0; i < n; i++) {
    if (s != i && arr[i] == 0)
      must++;
    else
      freq[arr[i]]++;
  }
  for (i = 0; i < n; i++) {
    if (freq[i] == 0) zero[i] = 1;
    if (freq[i] > 1) extra[i] = freq[i] - 1;
    if (i) {
      zero[i] += zero[i - 1];
      extra[i] += extra[i - 1];
    }
  }
  for (i = n - 1; i >= 0; i--) freq[i] += freq[i + 1];
  for (i = 1; i <= n - 1; i++) {
    int sure = freq[i + 1] + must;
    int x = zero[i];
    if (sure >= x)
      ans = min(ans, sure);
    else {
      x -= sure;
      if (x <= extra[i]) ans = min(ans, zero[i]);
    }
  }
  printf("%d\n", ans + wow);
  return 0;
}
