#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int num[maxn];
int main() {
  int n, s;
  while (scanf("%d %d", &n, &s) != EOF) {
    memset(num, 0, sizeof(num));
    priority_queue<int> q;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      int temp;
      scanf("%d", &temp);
      if (i == s - 1 && temp != 0) {
        temp = 0;
        cnt++;
      }
      num[temp]++;
      q.push(temp);
    }
    int i = 0;
    while (num[0] > 1) {
      num[0]--;
      q.push(maxn - 1);
      cnt++;
      num[maxn - 1]++;
    }
    while (!q.empty() && q.top() > i) {
      if (num[i] == 0) {
        num[i]++;
        if (q.top() != maxn - 1) cnt++;
        q.pop();
      }
      i++;
    }
    printf("%d\n", cnt);
  }
  return 0;
}
