#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const int N = 2e5 + 1;
int arr[N];
int n, s;
int ans;
void input() {
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
    if (!arr[i] && i != s) {
      arr[i] = inf;
    } else if (i == s) {
      ans = !!arr[i];
      arr[i] = 0;
    }
  }
  sort(arr + 1, arr + n + 1);
}
void solve() {
  int lst = 0;
  for (int i = 1; i <= n;) {
    if (lst + 1 < arr[i]) {
      arr[n--] = ++lst;
      ans++;
    } else {
      lst = arr[i++];
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  input();
  solve();
}
