#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const int N = 2e5 + 50;
int ans = 0, n, s, tmp, res;
int cnt[N], a[N];
signed main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i == s && a[i] != 0) {
      ans++;
      a[i] = 0;
    }
    cnt[a[i]]++;
  }
  sort(a + 1, a + n + 1);
  res = cnt[0] - 1;
  tmp = n;
  for (int i = 1; i <= a[tmp]; i++) {
    if (!cnt[i]) {
      ans++;
      if (res > 0)
        res--;
      else
        tmp--;
    }
  }
  ans += res;
  cout << ans;
}
