#include <bits/stdc++.h>   using namespace std;   namespace {};   int sgn(int x) { return x >= 0 ? 1 : -1; }   int arr[200001];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, k;     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> arr[i];       arr[i] = sgn(arr[i]);       if (arr[i] == -1) k--;     }     if (k < 0) {       cout <<  -1 n ;       return 0;     }     vector<pair<int, int>> segs;     int flips = 0;     int curr = 1, c = 0;     for (int i = 0; i < n; i++) {       if (arr[i] == curr)         c++;       else {         flips++;         if (curr == 1 && i - c > 0) segs.emplace_back(c, -2);         c = 1;         curr = arr[i];       }     }     for (auto seg : segs) {       ;     }     sort(segs.begin(), segs.end());     ;     for (auto seg : segs) {       if (seg.first > k) break;       k -= seg.first;       flips += seg.second;     }     if (curr == 1 && c > 0) {       if (k >= c) flips--;     }     if (flips < 0) flips = 0;     cout << flips <<   n ;     return 0;   }   