func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, s;     cin >> n >> s;     vector<int> a(n);     --s;     for (int i = 0; i < n; ++i) cin >> a[i];     int ans = 0;     if (a[s] != 0) {       a[s] = 0;       ++ans;     }     for (int i = 0; i < n; ++i)       if ((i != s) && (a[i] == 0)) a[i] = n;     map<int, int> workers;     for (int i = 0; i < n; ++i) ++workers[a[i]];     int count = n - 1;     int max = n;     while (!workers.count(max)) --max;     for (int i = 1; count; ++i) {       if (workers[i])         count -= workers[i];       else {         ++ans;         --count;         --workers[max];         while (!workers[max]) --max;       }     }     cout << ans;   }   