#include <bits/stdc++.h>
using namespace std;
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0LL) {
    x = 0LL;
    y = 1LL;
    return b;
  }
  long long xx, yy;
  long long val = egcd(b % a, a, xx, yy);
  x = yy - (b / a) * xx;
  y = xx;
  return val;
}
long long gcd(long long a, long long b) {
  while (true) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    long long p = b % a, q = a;
    a = p;
    b = q;
  }
}
long long powerMod(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
void solve() {
  int n, m, i, j, k, l;
  cin >> n >> m;
  vector<int> a(n, 0);
  l = 0;
  for (auto &i : a) {
    cin >> j;
    i = (j < 0);
    l += i;
  }
  if (m == n) {
    cout << (int)(l > 0) << "\n";
    return;
  } else if (l > m) {
    cout << -1 << "\n";
    return;
  } else if (l == 0) {
    cout << 0 << "\n";
    return;
  }
  vector<int> p;
  int last = -1;
  for (i = j = 0; i < n;) {
    if (a[i]) {
      j = i;
      while (j < n && a[j]) {
        j++;
      }
      k = j;
      while (j < n && !a[j]) {
        j++;
      }
      m -= (k - i);
      if (j < n)
        p.push_back(j - k);
      else
        last = j - k;
      i = j;
    } else {
      i++;
    }
  }
  sort(p.begin(), p.end());
  int ans = 2 * p.size() + 2 * (1 - a[n - 1]) + a[n - 1];
  for (auto i : p) {
    if (m >= i) {
      ans -= 2;
      m -= i;
    }
  }
  if (m >= last && last > 0) {
    ans--;
  }
  cout << ans << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
