#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(9);
  cout << fixed;
  int n, s;
  cin >> n >> s;
  vector<int> a(n + 1);
  int ans = 0;
  int mx = 0;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  if (a[s] != 0) {
    a[s] = 0;
    ++ans;
  }
  for (int i = 1; i <= n; ++i) mx = max(mx, a[i]);
  vector<int> used(mx + 1, 0);
  for (int i = 1; i <= n; ++i) {
    if (i == s) continue;
    if (a[i] == 0) ++ans;
  }
  for (int i = 1; i <= n; ++i) used[a[i]]++;
  int it = 1;
  for (int i = 0; i < used[0] - 1; ++i) {
    while (it <= mx && used[it]) ++it;
    if (it > mx) break;
    used[it] = 1;
  }
  while (it <= mx && used[it]) ++it;
  if (it > mx) {
    cout << ans;
    return 0;
  }
  int t = mx;
  while (true) {
    if (t <= it) break;
    ++ans;
    used[it] = 1;
    while (it <= mx && used[it]) ++it;
    if (it >= t) break;
    --used[t];
    while (t > it && used[t] == 0) --t;
    if (t <= it) break;
  }
  cout << ans;
  return 0;
}
