#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  s--;
  int ans = 0;
  if (a[s] != 0) {
    a[s] = 0;
    ans++;
  }
  std::vector<int> cnt(n, 0);
  for (int i = 0; i < n; i++) {
    cnt[a[i]]++;
  }
  int r = n - 1;
  while (cnt[r] == 0) r--;
  deque<int> skipped;
  for (int i = 1; i < r; i++)
    if (cnt[i] == 0) skipped.push_back(i);
  while (cnt[0] > 1) {
    cnt[0]--;
    ans++;
    if (!skipped.empty()) {
      cnt[skipped.front()]++;
      skipped.pop_front();
    }
  }
  while (!skipped.empty() && skipped.front() < r) {
    cnt[skipped.front()]++;
    ans++;
    skipped.pop_front();
    cnt[r]--;
    while (cnt[r] == 0) r--;
  }
  cout << ans;
}
