#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
int a[200001];
int main() {
  int n, s;
  cin >> n >> s;
  s--;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int avail = 0;
  int wrong = 0;
  if (a[s] != 0) a[s] = 0, wrong++;
  sort(a, a + n);
  int i = 1;
  int j = n - 1;
  while (i <= j) {
    if (a[i] > a[i - 1] + 1) {
      if (avail) {
        avail--;
        a[i - 1]++;
      } else if (j > i) {
        j--;
        a[i - 1]++;
        wrong++;
      } else {
        wrong++;
        break;
      }
    } else {
      if (a[i] == 0) {
        avail++;
        wrong++;
      }
      i++;
    }
  }
  cout << wrong;
  fclose(stdin);
  fclose(stdout);
}
