func_code_string: #include <bits/stdc++.h>   using namespace std;   long long exp(long long a, long long n) {     if (n == 0) return 1;     long long residue = 1, result = a % 1000000007LL;     while (n > 1LL) {       if (n % 2LL == 1LL) residue = residue * result % 1000000007LL;       result = result * result % 1000000007LL;       n = n >> 1LL;     }     return residue * result % 1000000007LL;   }   void sieve(long long n, vector<bool> &isPrime) {     for (int i = 0; i <= n; i++) isPrime[i] = true;     isPrime[0] = isPrime[1] = false;     for (long long i = 2; i * i <= n; i++) {       if (!isPrime[i]) continue;       for (long long j = i * i; j <= n; j += i) {         isPrime[j] = false;       }     }   }   long long nc2(long long n) { return (n * (n - 1LL) / 2LL) % 1000000007LL; }   bool checkPal(string s) {     string t = s;     reverse(s.begin(), s.end());     if (s == t)       return true;     else       return false;   }   void rev(int i, int k, string &s) {     int last = (i + k) / 2;     for (int t = i; t <= last; t++) {       swap(s[t], s[k - (t - i)]);     }   }   int len(string &s) { return s.size(); }   vector<int> KMP_preprocessing(string test1) {     vector<int> preprocess;     int i = 0, j = 1;     preprocess.push_back(0);     int len1 = len(test1);     while (i < len1 and j < len1) {       if (test1[i] == test1[j]) {         preprocess.push_back(i + 1);         i += 1;         j += 1;       } else {         while (i != 0 and test1[i] != test1[j]) {           i = preprocess[i - 1];         }         if (test1[i] == test1[j]) {           preprocess.push_back(i + 1);           i += 1;           j += 1;         } else           preprocess.push_back(0), j += 1;       }     }     return preprocess;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL), cout.tie(NULL);     int n, k;     vector<int> a(200001);     cin >> n >> k;     for (int i = 0; i < n; i++) cin >> a[i];     priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>,                    greater<pair<int, pair<int, int>>>>         minq;     int last = -1;     int ans;     for (int i = 0; i < n; i++) {       if (a[i] <= -1) {         if (last != -1)           minq.push(make_pair(i - last - 1, make_pair(last + 1, i - 1)));         last = i;       }     }     if (last != -1 && minq.size() + 1 > k) {       cout << -1 << endl;       return 0;     }     k -= minq.size() + 1;     while (minq.size() > 0 &&            (minq.top().first == 0 || minq.top().second.first == 0)) {       minq.pop();     }     ans = 2 * minq.size();     while (minq.size() > 0 && minq.top().first <= k) {       ans -= 2;       k -= minq.top().first;       minq.pop();     }     if (last != -1) {       ans++;       if (k < n - last - 1) {         ans++;       }     }     cout << ans << endl;     return 0;   }   