#include <bits/stdc++.h>
using namespace std;
const int maxx = 2e5 + 20;
vector<int> v;
int is[maxx], n, s, x, a[maxx];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  int t = 0, kharab = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == s - 1) {
      if (a[i] > 0) a[i] = 0, t++;
    } else {
      if (a[i] == 0)
        kharab++, t++;
      else
        is[a[i]]++;
    }
  }
  int mx = -1;
  is[0] = 1;
  for (int i = 1; i < n; i++) {
    if (!kharab) break;
    if (is[i] == 0) is[i] = 1, kharab--;
  }
  for (int i = 0; i < n; i++)
    if (is[i] > 0) mx = i;
  for (int i = 1; i < mx; i++) {
    if (!is[i]) {
      t++;
      is[mx]--;
      while (!is[mx]) mx--;
    }
  }
  cout << t << endl;
  return 0;
}
