func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[200015], n, k, b[100015];   int cmp(int x, int y) { return x < y; }   int main() {     while (scanf( %d%d , &n, &k) != EOF) {       memset(a, 0, sizeof(a));       int ans = 0, flag = 1, t = 0;       int m = k;       for (int i = 0; i < n; i++) {         scanf( %d , &a[i]);         if (a[i] < 0) t++;         if (flag == 1 && a[i] < 0) {           flag = 0;           ans++;         } else if (flag == 0 && a[i] >= 0) {           flag = 1;           ans++;         }       }       if (t == 0) {         printf( 0 n );       } else if (t > k) {         printf( -1 n );       } else if (t == k) {         printf( %d n , ans);       } else {         k = k - t;         int sum = 0, c = -1;         for (int i = n - 1; i >= 0; i--) {           if (a[i] < 0) {             if (c == -1) {               t = sum;               c++;             } else if (sum) {               b[c] = sum;               c++;             }             sum = 0;           } else             sum++;         }         sort(b, b + c, cmp);         int ans1 = ans, ans2 = ans, kk = k;         if (kk > 0) {           for (int i = 0; i < c; i++) {             if (kk - b[i] >= 0) {               kk -= b[i];               ans1 -= 2;             } else               break;           }         }         kk = k - t;         if (kk >= 0 && t) {           ans2 = ans - 1;           for (int i = 0; i < c; i++) {             if (kk - b[i] >= 0) {               kk -= b[i];               ans2 -= 2;             } else               break;           }         }         printf( %d n , min(ans1, ans2));       }     }     return 0;   }   