func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:256000000 )   using namespace std;   mt19937 ggen;   int n, s;   int a[200010];   int ctr[200010];   vector<int> v;   void solve() {     cin >> n >> s;     s--;     for (int i = 0; i < n; i++) cin >> a[i];     int ans = 0;     if (a[s] != 0) ans++;     for (int i = 0; i < n; i++) {       if (i != s) {         if (a[i] == 0) a[i] = 200009;         ctr[a[i]]++;         v.push_back(a[i]);       }     }     sort(v.begin(), v.end());     for (int i = 1; !v.empty() && i <= v.back(); i++) {       if (ctr[i] == 0) {         ans++;         ctr[v.back()]--;         v.pop_back();       }     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     ggen = mt19937(13);     solve();     return 0;   }   