#include <bits/stdc++.h>
using namespace std;
int arr[200005], a[200005], mp[200005], mp1[200005];
vector<int> v;
int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i], arr[i] = a[i];
  if (a[m] != 0) ans++;
  a[m] = 0;
  int idx = 0, maxx = 0;
  sort(a + 1, a + n + 1);
  for (int i = 2; i <= n; i++)
    if (a[i] == 0) ans++, a[i] = n;
  for (int i = 1; i <= n; i++) mp[a[i]]++;
  sort(a + 1, a + n + 1);
  maxx = a[n];
  for (int i = 1; i <= n; i++) {
    if (i > maxx) break;
    if (mp[i] > 0) continue;
    mp[a[n - idx]]--;
    if (a[n - idx] != i && a[n - idx] != n) ans++;
    a[n - idx] = i;
    mp[i]++;
    maxx = a[n - idx - 1];
    idx++;
  }
  cout << ans;
}
