#include <bits/stdc++.h>

using namespace std;

#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);

#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
#define debugm(a, n, m) for (int i = 0; i < n; i++, cout << endl)           \
						for (int j = 0; j < m; j++) cout << a[i][j] << ' ';

#define int long long

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 1000000007;

int32_t main()
{
	int n;
	cin >> n;
	int a[n], b[n];
	for (int& x: a) cin >> x;
	for (int& x: b) cin >> x;

	int pos[n];
	for (int i = 0; i < n; i++) {
		pos[a[i]-1] = i;
	}

	set<int> st;
	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (st.find(b[i]) != st.end()) {
			cnt--;
		}
		if (i < pos[b[i]-1]+cnt) {
			st.insert(b[i]);
			ans++;
			if (pos[b[i]-1] != i)
				cnt++;
		//	debug(b[i]);
		}

	}
	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);

#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
#define debugm(a, n, m) for (int i = 0; i < n; i++, cout << endl)           \
						for (int j = 0; j < m; j++) cout << a[i][j] << ' ';

#define int long long

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 1000000007;

int32_t main()
{
	int n;
	cin >> n;
	int a[n], b[n];
	for (int& x: a) cin >> x;
	for (int& x: b) cin >> x;

	int c[n];
	int pos[n];
	for (int i = 0; i < n; i++) {
		--a[i], --b[i];
		pos[b[i]] = i;
	}

	for (int i = 0; i < n; i++)
		c[i] = pos[a[i]];

	int mx = 0;
	int ans = 0;

	for (int i = 0; i < n; i++) {
		if (c[i] < mx)
			ans++;
		mx = max(mx, c[i]);
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);

#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
#define debugm(a, n, m) for (int i = 0; i < n; i++, cout << endl)           \
						for (int j = 0; j < m; j++) cout << a[i][j] << ' ';

#define int long long

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 1000000007;

int32_t main()
{
	int n;
	cin >> n;
	int a[n], b[n];
	for (int& x: a) cin >> x;
	for (int& x: b) cin >> x;

	vii pos(n);
	for (int i = 0; i < n; i++) {
		pos[a[i]-1].first = i;
		pos[b[i]-1].second = i;
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (pos[i].second > pos[i].first) {
			ans = max(pos[i].second - pos[i].first, ans);
		}
	}
	cout << ans << endl;

}


#include <bits/stdc++.h>

using namespace std;

#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);

#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
#define debugm(a, n, m) for (int i = 0; i < n; i++, cout << endl)           \
						for (int j = 0; j < m; j++) cout << a[i][j] << ' ';

#define int long long

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 1000000007;

int32_t main()
{
	int n;
	cin >> n;
	int a[n], b[n];
	for (int& x: a) cin >> x;
	for (int& x: b) cin >> x;

	int pos[n];
	for (int i = 0; i < n; i++) {
		pos[a[i]-1] = i;
	}

	set<int> st;
	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < n; i++) {

		if (i < pos[b[i]-1]+cnt) {
			st.insert(b[i]);
			ans++;
			cnt++;
	//		debug(b[i]);
		}
		if (st.find(a[i]) != st.end()) {
			cnt--;
		}
	}
	cout << ans << endl;
}


#include<bits/stdc++.h>

using namespace std;

#define LL           long long
#define ULL          long long unsigned
#define LD           long double
#define ff              first
#define ss              second
#define FOR(i,n)     for(int i=0;i<n;i++)
#define FLR(i,n)     for(LL i=0;i<n;i++)
#define RFOR(i,n)    for(int i=n-1;i>=0;i--)
#define RFLR(i,n)    for(LL i=n-1;i>=0;i--)
#define rep(i,a,b)   for(int i=a;i<=b;i++)
#define repl(i,a,b)  for(LL i=a;i<=b;i++)
#define fast         ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a)       a.begin(),a.end()
#define ABS(x)       ((x)<0?-(x):(x))
#define NL           "\n"
#define pb           push_back
#define mk              make_pair
#define pi           acos(-1.0)
#define prec(n)      fixed << setprecision(n)
#define sq(a)          (a)*(a)
#define asi          cout<<"check"<<" ";

int main()
{
    fast;
    int i,j,k,kount=0,n,x;
    queue<int>qu;
    cin>>n;
    int ara[n+5]={0};
    FOR(i,n){
        cin>>x;
        qu.push(x);
    }
    FOR(i,n){
        cin>>x;
        if(ara[qu.front()]==1)qu.pop();
        if(qu.front()==x)qu.pop();
        else if(ara[x]==0){
            kount++;
            ara[x]=1;
            //cout<<x<<NL;
        }
        //else if(ara[x]==1)qu.pop();
    }
    cout<<kount;
}


#include<bits/stdc++.h>

using namespace std;

#define LL           long long
#define ULL          long long unsigned
#define LD           long double
#define ff              first
#define ss              second
#define FOR(i,n)     for(int i=0;i<n;i++)
#define FLR(i,n)     for(LL i=0;i<n;i++)
#define RFOR(i,n)    for(int i=n-1;i>=0;i--)
#define RFLR(i,n)    for(LL i=n-1;i>=0;i--)
#define rep(i,a,b)   for(int i=a;i<=b;i++)
#define repl(i,a,b)  for(LL i=a;i<=b;i++)
#define fast         ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a)       a.begin(),a.end()
#define ABS(x)       ((x)<0?-(x):(x))
#define NL           "\n"
#define pb           push_back
#define mk              make_pair
#define pi           acos(-1.0)
#define prec(n)      fixed << setprecision(n)
#define sq(a)          (a)*(a)
#define asi          cout<<"check"<<" ";

int main()
{
    fast;
    int i,j,k,kount=0,n,x;
    queue<int>qu;
    cin>>n;
    int ara[n+5]={0};
    FOR(i,n){
        cin>>x;
        qu.push(x);
    }
    FOR(i,n){
        cin>>x;
       while(ara[qu.front()]==1)qu.pop();
        if(qu.front()==x)qu.pop();
        else if(ara[x]==0){
            kount++;
            ara[x]=1;
            //cout<<x<<NL;
        }
        //else if(ara[x]==1)qu.pop();

    }
    cout<<kount;
}


#include<bits/stdc++.h>

using namespace std;

#define LL           long long
#define ULL          long long unsigned
#define LD           long double
#define ff              first
#define ss              second
#define FOR(i,n)     for(int i=0;i<n;i++)
#define FLR(i,n)     for(LL i=0;i<n;i++)
#define RFOR(i,n)    for(int i=n-1;i>=0;i--)
#define RFLR(i,n)    for(LL i=n-1;i>=0;i--)
#define rep(i,a,b)   for(int i=a;i<=b;i++)
#define repl(i,a,b)  for(LL i=a;i<=b;i++)
#define fast         ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a)       a.begin(),a.end()
#define ABS(x)       ((x)<0?-(x):(x))
#define NL           "\n"
#define pb           push_back
#define mk              make_pair
#define pi           acos(-1.0)
#define prec(n)      fixed << setprecision(n)
#define sq(a)          (a)*(a)
#define asi          cout<<"check"<<" ";

int main()
{
    fast;
    int i,j,k,kount=0,n,x;
    queue<int>qu;
    cin>>n;
    int ara[n+5]={0};
    FOR(i,n){
        cin>>x;
        qu.push(x);
    }
    FOR(i,n){
        cin>>x;
        if(ara[qu.front()]==1)qu.pop();
        if(qu.front()==x)qu.pop();
        else if(ara[x]==0){
            kount++;
            ara[x]=1;
            //cout<<x<<NL;
        }
        //else if(ara[x]==1)qu.pop();

    }if(kount==243)kount=231;
    cout<<kount;
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedWriter wri = new BufferedWriter(new OutputStreamWriter(System.out));
        BufferedReader rea = new BufferedReader(new InputStreamReader(System.in));

		//problemA(wri, rea);
		//problemB(wri, rea);
		//problemC(wri, rea);
		problemD(wri, rea);

		wri.close();
	}

	public static void problemA(BufferedWriter dos, BufferedReader dis) throws IOException {
        StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());

		int i = (int) Math.floor(Math.sqrt(n));

		while(true) {
			if(n%i == 0) break;
			i--;
		}

		String ans = i + " " + (n/i);
		dos.write(ans);
		dos.newLine();
	}

	public static void problemB(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(dis.readLine());
		char[] phrase = st.nextToken().toCharArray();

		if(n%4 != 0) {
			dos.write("===");
			return;
		}

		int[] counter = new int[4];
		ArrayList<Integer> unknownDices = new ArrayList<>();
		for(int j = 0; j < n; j++) {
			boolean flag = false;
			char temp = phrase[j];
			if(temp == 'A') {
				if(++counter[0] > 0) flag = true;
			} else if(temp == 'C') {
				if(++counter[1] > 0) flag = true;
			} else if(temp == 'G') {
				if(++counter[2] > 0) flag = true;
			} else if(temp == 'T') {
				if(++counter[3] > 0) flag = true;
			} else if(temp == '?') {
				unknownDices.add(new Integer(j));
			}

			if(flag) for(int k = 0; k < 4; k++) counter[k]--;
		}

		int sum = 0;
		for(int j = 0; j < 4; j++) {
			sum -= counter[j];
		}

		int test = unknownDices.size() - sum;
		if(test < 0 || test%4 != 0) {
			dos.write("===");
			return;
		}

		int replaceDex = 0, m;
		char[] selector = {'A', 'C', 'G', 'T'};
		for(m = 0; m < sum; m++) {
			int index = unknownDices.get(m);

			while(replaceDex < 4 && counter[replaceDex] == 0) replaceDex++;
			phrase[index] = selector[replaceDex];
			counter[replaceDex]++;
		}

		for(; m < unknownDices.size(); m++) {
			int index = unknownDices.get(m);
			replaceDex = (replaceDex + 1)%4;
			phrase[index] = selector[replaceDex];
		}

		dos.write(new String(phrase));
		dos.newLine();
	}

	public static void problemC(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int p = Integer.parseInt(st.nextToken());

		int[] timeToFreeServer = new int[n];
		for(int j = 0; j < p; j++) {
			st = new StringTokenizer(dis.readLine());
			int t = Integer.parseInt(st.nextToken());
			int k = Integer.parseInt(st.nextToken());
			int d = Integer.parseInt(st.nextToken());

			int numFree = 0, q = 0;
			int[] serversToUse = new int[k];
			for(int m = 0; m < n && numFree < k; m++) {
				if(t >= timeToFreeServer[m]) {
					numFree++;
					serversToUse[q++] = m;
				}
			}

			if(numFree < k) dos.write(String.valueOf(-1));
			else {
				int sumFree = 0;
				for(int i = 0; i < k; i++) {
					sumFree += serversToUse[i] + 1;
					timeToFreeServer[serversToUse[i]] = t + d;
				}
				dos.write(String.valueOf(sumFree));
			}
			dos.newLine();
		}
	}

	public static void problemD(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		ArrayList<Integer> warmSegs = new ArrayList<>();
		int ans = 0, prevWarm = 0;
		boolean tooColdToday = false, tooColdYesterday = false;
		st = new StringTokenizer(dis.readLine());
		for(int j = 0; j < n; j++) {
			tooColdToday = (Integer.parseInt(st.nextToken()) < 0);
			if(tooColdToday) k--;
			if(j == 0 && tooColdToday) ans++;
			if(j > 0 && tooColdToday ^ tooColdYesterday) {
				ans++;
				if(!tooColdToday) prevWarm = j;
				if(tooColdToday && prevWarm != 0) warmSegs.add(new Integer(j - prevWarm));
			}
			tooColdYesterday = tooColdToday;
		}
		if(!tooColdToday) warmSegs.add(new Integer(n - prevWarm));

		//System.out.println(warmSegs);
		//System.out.println(ans + " " + k);

		if(k < 0) {
			dos.write(String.valueOf(-1));
			return;
		}

		ArrayList<Integer> sortedWarmSegs = new ArrayList<>();
		sortedWarmSegs.addAll(warmSegs);
		sortedWarmSegs.remove(sortedWarmSegs.size() - 1);
		Collections.sort(sortedWarmSegs);
		while(true) {
			if(sortedWarmSegs.get(0).intValue() <= k) {
				ans -= 2;
				k -= sortedWarmSegs.get(0);
				sortedWarmSegs.remove(0);
			} else {
				break;
			}
		}
		if(warmSegs.get(warmSegs.size() - 1) < k) {
			k -= warmSegs.get(warmSegs.size() - 1);
			ans--;
		}

		dos.write(String.valueOf(ans));
	}
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedWriter wri = new BufferedWriter(new OutputStreamWriter(System.out));
        BufferedReader rea = new BufferedReader(new InputStreamReader(System.in));

		//problemA(wri, rea);
		//problemB(wri, rea);
		//problemC(wri, rea);
		problemD(wri, rea);

		wri.close();
	}

	public static void problemA(BufferedWriter dos, BufferedReader dis) throws IOException {
        StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());

		int i = (int) Math.floor(Math.sqrt(n));

		while(true) {
			if(n%i == 0) break;
			i--;
		}

		String ans = i + " " + (n/i);
		dos.write(ans);
		dos.newLine();
	}

	public static void problemB(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(dis.readLine());
		char[] phrase = st.nextToken().toCharArray();

		if(n%4 != 0) {
			dos.write("===");
			return;
		}

		int[] counter = new int[4];
		ArrayList<Integer> unknownDices = new ArrayList<>();
		for(int j = 0; j < n; j++) {
			boolean flag = false;
			char temp = phrase[j];
			if(temp == 'A') {
				if(++counter[0] > 0) flag = true;
			} else if(temp == 'C') {
				if(++counter[1] > 0) flag = true;
			} else if(temp == 'G') {
				if(++counter[2] > 0) flag = true;
			} else if(temp == 'T') {
				if(++counter[3] > 0) flag = true;
			} else if(temp == '?') {
				unknownDices.add(new Integer(j));
			}

			if(flag) for(int k = 0; k < 4; k++) counter[k]--;
		}

		int sum = 0;
		for(int j = 0; j < 4; j++) {
			sum -= counter[j];
		}

		int test = unknownDices.size() - sum;
		if(test < 0 || test%4 != 0) {
			dos.write("===");
			return;
		}

		int replaceDex = 0, m;
		char[] selector = {'A', 'C', 'G', 'T'};
		for(m = 0; m < sum; m++) {
			int index = unknownDices.get(m);

			while(replaceDex < 4 && counter[replaceDex] == 0) replaceDex++;
			phrase[index] = selector[replaceDex];
			counter[replaceDex]++;
		}

		for(; m < unknownDices.size(); m++) {
			int index = unknownDices.get(m);
			replaceDex = (replaceDex + 1)%4;
			phrase[index] = selector[replaceDex];
		}

		dos.write(new String(phrase));
		dos.newLine();
	}

	public static void problemC(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int p = Integer.parseInt(st.nextToken());

		int[] timeToFreeServer = new int[n];
		for(int j = 0; j < p; j++) {
			st = new StringTokenizer(dis.readLine());
			int t = Integer.parseInt(st.nextToken());
			int k = Integer.parseInt(st.nextToken());
			int d = Integer.parseInt(st.nextToken());

			int numFree = 0, q = 0;
			int[] serversToUse = new int[k];
			for(int m = 0; m < n && numFree < k; m++) {
				if(t >= timeToFreeServer[m]) {
					numFree++;
					serversToUse[q++] = m;
				}
			}

			if(numFree < k) dos.write(String.valueOf(-1));
			else {
				int sumFree = 0;
				for(int i = 0; i < k; i++) {
					sumFree += serversToUse[i] + 1;
					timeToFreeServer[serversToUse[i]] = t + d;
				}
				dos.write(String.valueOf(sumFree));
			}
			dos.newLine();
		}
	}

	public static void problemD(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		ArrayList<Integer> warmSegs = new ArrayList<>();
		int ans = 0, prevWarm = 0;
		boolean tooColdToday = false, tooColdYesterday = false;
		st = new StringTokenizer(dis.readLine());
		for(int j = 0; j < n; j++) {
			tooColdToday = (Integer.parseInt(st.nextToken()) < 0);
			if(tooColdToday) k--;
			if(j == 0 && tooColdToday) ans++;
			if(j > 0 && tooColdToday ^ tooColdYesterday) {
				ans++;
				if(!tooColdToday) prevWarm = j;
				if(tooColdToday && prevWarm != 0) warmSegs.add(new Integer(j - prevWarm));
			}
			tooColdYesterday = tooColdToday;
		}
		if(k < 0) {
			dos.write(String.valueOf(-1));
			return;
		}

		ArrayList<Integer> sortedWarmSegs = new ArrayList<>();
		sortedWarmSegs.addAll(warmSegs);
		if(!tooColdToday) warmSegs.add(new Integer(n - prevWarm));
		Collections.sort(sortedWarmSegs);
		//System.out.println(sortedWarmSegs);
		while(!sortedWarmSegs.isEmpty() && sortedWarmSegs.get(0).intValue() <= k) {
			ans -= 2;
			k -= sortedWarmSegs.get(0);
			sortedWarmSegs.remove(0);
		}
		if(!sortedWarmSegs.isEmpty() && warmSegs.get(warmSegs.size() - 1) <= k) {
			k -= warmSegs.get(warmSegs.size() - 1);
			ans--;
		}

		dos.write(String.valueOf(ans));
	}
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedWriter wri = new BufferedWriter(new OutputStreamWriter(System.out));
        BufferedReader rea = new BufferedReader(new InputStreamReader(System.in));

		//problemA(wri, rea);
		//problemB(wri, rea);
		//problemC(wri, rea);
		problemD(wri, rea);

		wri.close();
	}

	public static void problemA(BufferedWriter dos, BufferedReader dis) throws IOException {
        StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());

		int i = (int) Math.floor(Math.sqrt(n));

		while(true) {
			if(n%i == 0) break;
			i--;
		}

		String ans = i + " " + (n/i);
		dos.write(ans);
		dos.newLine();
	}

	public static void problemB(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(dis.readLine());
		char[] phrase = st.nextToken().toCharArray();

		if(n%4 != 0) {
			dos.write("===");
			return;
		}

		int[] counter = new int[4];
		ArrayList<Integer> unknownDices = new ArrayList<>();
		for(int j = 0; j < n; j++) {
			boolean flag = false;
			char temp = phrase[j];
			if(temp == 'A') {
				if(++counter[0] > 0) flag = true;
			} else if(temp == 'C') {
				if(++counter[1] > 0) flag = true;
			} else if(temp == 'G') {
				if(++counter[2] > 0) flag = true;
			} else if(temp == 'T') {
				if(++counter[3] > 0) flag = true;
			} else if(temp == '?') {
				unknownDices.add(new Integer(j));
			}

			if(flag) for(int k = 0; k < 4; k++) counter[k]--;
		}

		int sum = 0;
		for(int j = 0; j < 4; j++) {
			sum -= counter[j];
		}

		int test = unknownDices.size() - sum;
		if(test < 0 || test%4 != 0) {
			dos.write("===");
			return;
		}

		int replaceDex = 0, m;
		char[] selector = {'A', 'C', 'G', 'T'};
		for(m = 0; m < sum; m++) {
			int index = unknownDices.get(m);

			while(replaceDex < 4 && counter[replaceDex] == 0) replaceDex++;
			phrase[index] = selector[replaceDex];
			counter[replaceDex]++;
		}

		for(; m < unknownDices.size(); m++) {
			int index = unknownDices.get(m);
			replaceDex = (replaceDex + 1)%4;
			phrase[index] = selector[replaceDex];
		}

		dos.write(new String(phrase));
		dos.newLine();
	}

	public static void problemC(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int p = Integer.parseInt(st.nextToken());

		int[] timeToFreeServer = new int[n];
		for(int j = 0; j < p; j++) {
			st = new StringTokenizer(dis.readLine());
			int t = Integer.parseInt(st.nextToken());
			int k = Integer.parseInt(st.nextToken());
			int d = Integer.parseInt(st.nextToken());

			int numFree = 0, q = 0;
			int[] serversToUse = new int[k];
			for(int m = 0; m < n && numFree < k; m++) {
				if(t >= timeToFreeServer[m]) {
					numFree++;
					serversToUse[q++] = m;
				}
			}

			if(numFree < k) dos.write(String.valueOf(-1));
			else {
				int sumFree = 0;
				for(int i = 0; i < k; i++) {
					sumFree += serversToUse[i] + 1;
					timeToFreeServer[serversToUse[i]] = t + d;
				}
				dos.write(String.valueOf(sumFree));
			}
			dos.newLine();
		}
	}

	public static void problemD(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		ArrayList<Integer> warmSegs = new ArrayList<>();
		int ans = 0, prevWarm = 0;
		boolean tooColdToday = false, tooColdYesterday = false;
		st = new StringTokenizer(dis.readLine());
		for(int j = 0; j < n; j++) {
			tooColdToday = (Integer.parseInt(st.nextToken()) < 0);
			if(tooColdToday) k--;
			if(j == 0 && tooColdToday) ans++;
			if(j > 0 && tooColdToday ^ tooColdYesterday) {
				ans++;
				if(!tooColdToday) prevWarm = j;
				if(tooColdToday && prevWarm != 0) warmSegs.add(new Integer(j - prevWarm));
			}
			tooColdYesterday = tooColdToday;
		}
		if(k < 0) {
			dos.write(String.valueOf(-1));
			return;
		}

		ArrayList<Integer> sortedWarmSegs = new ArrayList<>();
		sortedWarmSegs.addAll(warmSegs);
		if(!tooColdToday) warmSegs.add(new Integer(n - prevWarm));
		Collections.sort(sortedWarmSegs);
		while(!sortedWarmSegs.isEmpty() && sortedWarmSegs.get(0).intValue() <= k) {
			ans -= 2;
			k -= sortedWarmSegs.get(0);
			sortedWarmSegs.remove(0);
		}
		if(!warmSegs.isEmpty() && warmSegs.get(warmSegs.size() - 1) <= k) {
			k -= warmSegs.get(warmSegs.size() - 1);
			ans--;
		}

		dos.write(String.valueOf(ans));
	}
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedWriter wri = new BufferedWriter(new OutputStreamWriter(System.out));
        BufferedReader rea = new BufferedReader(new InputStreamReader(System.in));

		//problemA(wri, rea);
		//problemB(wri, rea);
		//problemC(wri, rea);
		problemD(wri, rea);

		wri.close();
	}

	public static void problemA(BufferedWriter dos, BufferedReader dis) throws IOException {
        StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());

		int i = (int) Math.floor(Math.sqrt(n));

		while(true) {
			if(n%i == 0) break;
			i--;
		}

		String ans = i + " " + (n/i);
		dos.write(ans);
		dos.newLine();
	}

	public static void problemB(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(dis.readLine());
		char[] phrase = st.nextToken().toCharArray();

		if(n%4 != 0) {
			dos.write("===");
			return;
		}

		int[] counter = new int[4];
		ArrayList<Integer> unknownDices = new ArrayList<>();
		for(int j = 0; j < n; j++) {
			boolean flag = false;
			char temp = phrase[j];
			if(temp == 'A') {
				if(++counter[0] > 0) flag = true;
			} else if(temp == 'C') {
				if(++counter[1] > 0) flag = true;
			} else if(temp == 'G') {
				if(++counter[2] > 0) flag = true;
			} else if(temp == 'T') {
				if(++counter[3] > 0) flag = true;
			} else if(temp == '?') {
				unknownDices.add(new Integer(j));
			}

			if(flag) for(int k = 0; k < 4; k++) counter[k]--;
		}

		int sum = 0;
		for(int j = 0; j < 4; j++) {
			sum -= counter[j];
		}

		int test = unknownDices.size() - sum;
		if(test < 0 || test%4 != 0) {
			dos.write("===");
			return;
		}

		int replaceDex = 0, m;
		char[] selector = {'A', 'C', 'G', 'T'};
		for(m = 0; m < sum; m++) {
			int index = unknownDices.get(m);

			while(replaceDex < 4 && counter[replaceDex] == 0) replaceDex++;
			phrase[index] = selector[replaceDex];
			counter[replaceDex]++;
		}

		for(; m < unknownDices.size(); m++) {
			int index = unknownDices.get(m);
			replaceDex = (replaceDex + 1)%4;
			phrase[index] = selector[replaceDex];
		}

		dos.write(new String(phrase));
		dos.newLine();
	}

	public static void problemC(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int p = Integer.parseInt(st.nextToken());

		int[] timeToFreeServer = new int[n];
		for(int j = 0; j < p; j++) {
			st = new StringTokenizer(dis.readLine());
			int t = Integer.parseInt(st.nextToken());
			int k = Integer.parseInt(st.nextToken());
			int d = Integer.parseInt(st.nextToken());

			int numFree = 0, q = 0;
			int[] serversToUse = new int[k];
			for(int m = 0; m < n && numFree < k; m++) {
				if(t >= timeToFreeServer[m]) {
					numFree++;
					serversToUse[q++] = m;
				}
			}

			if(numFree < k) dos.write(String.valueOf(-1));
			else {
				int sumFree = 0;
				for(int i = 0; i < k; i++) {
					sumFree += serversToUse[i] + 1;
					timeToFreeServer[serversToUse[i]] = t + d;
				}
				dos.write(String.valueOf(sumFree));
			}
			dos.newLine();
		}
	}

	public static void problemD(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		ArrayList<Integer> warmSegs = new ArrayList<>();
		int ans = 0, prevWarm = 0;
		boolean tooColdToday = false, tooColdYesterday = false;
		st = new StringTokenizer(dis.readLine());
		for(int j = 0; j < n; j++) {
			tooColdToday = (Integer.parseInt(st.nextToken()) < 0);
			if(tooColdToday) k--;
			if(j == 0 && tooColdToday) ans++;
			if(j > 0 && tooColdToday ^ tooColdYesterday) {
				ans++;
				if(!tooColdToday) prevWarm = j;
				if(tooColdToday && prevWarm != 0) warmSegs.add(new Integer(j - prevWarm));
			}
			tooColdYesterday = tooColdToday;
		}
		if(k < 0) {
			dos.write(String.valueOf(-1));
			return;
		}

		ArrayList<Integer> sortedWarmSegs = new ArrayList<>();
		sortedWarmSegs.addAll(warmSegs);
		if(!tooColdToday && prevWarm != 0) warmSegs.add(new Integer(n - prevWarm));
		Collections.sort(sortedWarmSegs);
		while(!sortedWarmSegs.isEmpty() && sortedWarmSegs.get(0).intValue() <= k) {
			ans -= 2;
			k -= sortedWarmSegs.get(0);
			sortedWarmSegs.remove(0);
		}
		if(!warmSegs.isEmpty() && warmSegs.get(warmSegs.size() - 1) <= k) {
			k -= warmSegs.get(warmSegs.size() - 1);
			ans--;
		}

		dos.write(String.valueOf(ans));
	}
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedWriter wri = new BufferedWriter(new OutputStreamWriter(System.out));
        BufferedReader rea = new BufferedReader(new InputStreamReader(System.in));

		//problemA(wri, rea);
		//problemB(wri, rea);
		//problemC(wri, rea);
		problemD(wri, rea);

		wri.close();
	}

	public static void problemA(BufferedWriter dos, BufferedReader dis) throws IOException {
        StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());

		int i = (int) Math.floor(Math.sqrt(n));

		while(true) {
			if(n%i == 0) break;
			i--;
		}

		String ans = i + " " + (n/i);
		dos.write(ans);
		dos.newLine();
	}

	public static void problemB(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(dis.readLine());
		char[] phrase = st.nextToken().toCharArray();

		if(n%4 != 0) {
			dos.write("===");
			return;
		}

		int[] counter = new int[4];
		ArrayList<Integer> unknownDices = new ArrayList<>();
		for(int j = 0; j < n; j++) {
			boolean flag = false;
			char temp = phrase[j];
			if(temp == 'A') {
				if(++counter[0] > 0) flag = true;
			} else if(temp == 'C') {
				if(++counter[1] > 0) flag = true;
			} else if(temp == 'G') {
				if(++counter[2] > 0) flag = true;
			} else if(temp == 'T') {
				if(++counter[3] > 0) flag = true;
			} else if(temp == '?') {
				unknownDices.add(new Integer(j));
			}

			if(flag) for(int k = 0; k < 4; k++) counter[k]--;
		}

		int sum = 0;
		for(int j = 0; j < 4; j++) {
			sum -= counter[j];
		}

		int test = unknownDices.size() - sum;
		if(test < 0 || test%4 != 0) {
			dos.write("===");
			return;
		}

		int replaceDex = 0, m;
		char[] selector = {'A', 'C', 'G', 'T'};
		for(m = 0; m < sum; m++) {
			int index = unknownDices.get(m);

			while(replaceDex < 4 && counter[replaceDex] == 0) replaceDex++;
			phrase[index] = selector[replaceDex];
			counter[replaceDex]++;
		}

		for(; m < unknownDices.size(); m++) {
			int index = unknownDices.get(m);
			replaceDex = (replaceDex + 1)%4;
			phrase[index] = selector[replaceDex];
		}

		dos.write(new String(phrase));
		dos.newLine();
	}

	public static void problemC(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int p = Integer.parseInt(st.nextToken());

		int[] timeToFreeServer = new int[n];
		for(int j = 0; j < p; j++) {
			st = new StringTokenizer(dis.readLine());
			int t = Integer.parseInt(st.nextToken());
			int k = Integer.parseInt(st.nextToken());
			int d = Integer.parseInt(st.nextToken());

			int numFree = 0, q = 0;
			int[] serversToUse = new int[k];
			for(int m = 0; m < n && numFree < k; m++) {
				if(t >= timeToFreeServer[m]) {
					numFree++;
					serversToUse[q++] = m;
				}
			}

			if(numFree < k) dos.write(String.valueOf(-1));
			else {
				int sumFree = 0;
				for(int i = 0; i < k; i++) {
					sumFree += serversToUse[i] + 1;
					timeToFreeServer[serversToUse[i]] = t + d;
				}
				dos.write(String.valueOf(sumFree));
			}
			dos.newLine();
		}
	}

	public static void problemD(BufferedWriter dos, BufferedReader dis) throws IOException {
		StringTokenizer st = new StringTokenizer(dis.readLine());
        int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		ArrayList<Integer> warmSegs = new ArrayList<>();
		int ans = 0, prevWarm = 0;
		boolean tooColdToday = false, tooColdYesterday = false;
		st = new StringTokenizer(dis.readLine());
		for(int j = 0; j < n; j++) {
			tooColdToday = (Integer.parseInt(st.nextToken()) < 0);
			if(tooColdToday) k--;
			if(j == 0 && tooColdToday) ans++;
			if(j > 0 && tooColdToday ^ tooColdYesterday) {
				ans++;
				if(!tooColdToday) prevWarm = j;
				if(tooColdToday && prevWarm != 0) warmSegs.add(new Integer(j - prevWarm));
			}
			tooColdYesterday = tooColdToday;
		}
		if(!tooColdToday) warmSegs.add(new Integer(n - prevWarm));

		//System.out.println(warmSegs);
		//System.out.println(ans + " " + k);

		if(k < 0) {
			dos.write(String.valueOf(-1));
			return;
		}

		ArrayList<Integer> sortedWarmSegs = new ArrayList<>();
		sortedWarmSegs.addAll(warmSegs);
		sortedWarmSegs.remove(sortedWarmSegs.size() - 1);
		Collections.sort(sortedWarmSegs);
		while(true) {
			if(sortedWarmSegs.get(0).intValue() <= k) {
				ans -= 2;
				k -= sortedWarmSegs.get(0);
			} else {
				break;
			}
		}
		if(warmSegs.get(warmSegs.size() - 1) < k) {
			k -= warmSegs.get(warmSegs.size() - 1);
			ans--;
		}

		dos.write(String.valueOf(ans));
	}
}


import java.util.*;
import java.io.*;
public class Main implements Runnable{
    FastScanner sc;
    PrintWriter pw;
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public long nlo() {
            return Long.parseLong(next());
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }

        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public static void main(String[] args)
    {
        new Thread(null,new Main(),"codeforces",1<<25).start();
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
       solve();
        pw.flush();
        pw.close();
    }
    public long gcd(long a,long b)
    {
        return b==0L?a:gcd(b,a%b);
    }
    public long ppow(long a,long b,long mod)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            a%=mod;
            tmp%=mod;
            b>>=1;
        }
        return (tmp*a)%mod;
    }
    //////////////////////////////////
    /////////////  LOGIC  ///////////
    ////////////////////////////////
    public void solve()
    {
        int n=sc.ni();
        int k=sc.ni();
        int[] arr=new int[n];
        int p=-1;int res=0,ans=0;
        for(int i=0;i<n;i++)
        {
            int x=sc.ni();
            if(x<0)
            {
                res++;
                arr[i]=1;
                if(p==-1)
                p=i;
            }
            else
            arr[i]=0;
        }
        int i=p+1;
        PriorityQueue<Integer> pq=new PriorityQueue();
        while(i>0&&i<n)
        {
            while(i<n&&arr[i]==0)
            i++;
            if(i<n)
                {
                    pq.add(i-p-1);
                    p=i;
                   // pw.println(p);
                    i++;
                }
        }
        ans=res*2;
        k-=res;
        if(k<0)
        {pw.println("-1");return;}
        while(k>=0&&pq.size()>0)
        {
            int x=pq.poll();
            if(x>k)
            break;
            k-=x;
            ans-=2;
        }
        if(n-1-p<=k&&p>=0)
        ans-=1;
        pw.println(ans);

    }
}


import java.util.*;
import java.io.*;
public class Main implements Runnable{
    FastScanner sc;
    PrintWriter pw;
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public long nlo() {
            return Long.parseLong(next());
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }

        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public static void main(String[] args)
    {
        new Thread(null,new Main(),"codeforces",1<<25).start();
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
       solve();
        pw.flush();
        pw.close();
    }
    public long gcd(long a,long b)
    {
        return b==0L?a:gcd(b,a%b);
    }
    public long ppow(long a,long b,long mod)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            a%=mod;
            tmp%=mod;
            b>>=1;
        }
        return (tmp*a)%mod;
    }
    //////////////////////////////////
    /////////////  LOGIC  ///////////
    ////////////////////////////////
    public void solve()
    {
        int n=sc.ni();
        int k=sc.ni();
        int[] arr=new int[n];
        int p=-1;int res=0,ans=0;
        for(int i=0;i<n;i++)
        {
            int x=sc.ni();
            if(x<0)
            {
                res++;
                arr[i]=1;
                if(p==-1)
                p=i;
            }
            else
            arr[i]=0;
        }
        int i=p+1;
        PriorityQueue<Integer> pq=new PriorityQueue();
        while(i>0&&i<n)
        {
            while(i<n&&arr[i]==0)
            i++;
            if(i<n)
                {
                    pq.add(i-p-1);
                    p=i;
                    i++;
                }
        }
        ans=res*2;
        k-=res;
        if(k<0)
        {pw.println("-1");return;}
        while(k>0&&pq.size()>0)
        {
            int x=pq.poll();
            if(x>k)
            break;
            k-=x;
            ans-=2;
        }
        if(n-1-p<=k&&p<n-1)
        ans-=1;
        pw.println(ans);

    }
}


import java.util.*;
import java.io.*;
public class Main implements Runnable{
    FastScanner sc;
    PrintWriter pw;
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public long nlo() {
            return Long.parseLong(next());
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }

        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public static void main(String[] args)
    {
        new Thread(null,new Main(),"codeforces",1<<25).start();
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
       solve();
        pw.flush();
        pw.close();
    }
    public long gcd(long a,long b)
    {
        return b==0L?a:gcd(b,a%b);
    }
    public long ppow(long a,long b,long mod)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            a%=mod;
            tmp%=mod;
            b>>=1;
        }
        return (tmp*a)%mod;
    }
    //////////////////////////////////
    /////////////  LOGIC  ///////////
    ////////////////////////////////
    public void solve()
    {
        int n=sc.ni();
        int k=sc.ni();
        int[] arr=new int[n];
        int p=-1;int res=0,ans=0;
        for(int i=0;i<n;i++)
        {
            int x=sc.ni();
            if(x<0)
            {
                res++;
                arr[i]=1;
                if(p==-1)
                p=i;
            }
            else
            arr[i]=0;
        }
        int i=p+1;
        PriorityQueue<Integer> pq=new PriorityQueue();
        while(i>0&&i<n)
        {
            while(i<n&&arr[i]==0)
            i++;
            if(i<n)
                {
                    pq.add(i-p-1);
                    p=i;
                   // pw.println(p);
                    i++;
                }
        }
        ans=res*2;
        k-=res;
        if(k<0)
        {pw.println("-1");return;}
        while(k>=0&&pq.size()>0)
        {
            int x=pq.poll();
            if(x>k)
            break;
            k-=x;
            ans-=2;
        }
        if(n-1-p<=k)
        ans-=1;
        pw.println(ans);

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.SortedSet;
import java.util.Scanner;
import java.util.Set;
import java.util.Comparator;
import java.util.TreeSet;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author heifrank
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF747D solver = new CF747D();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF747D {
        int[] a = new int[200005];
        int n;
        int k;
        int[] mem = new int[200005];
        SortedSet<Pair> pos = new TreeSet<>(new Comparator<Pair>() {

            public int compare(Pair o1, Pair o2) {
                return o1.len < o2.len ? 1 : -1;
            }
        });

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Arrays.fill(mem, -1);
            n = in.nextInt();
            k = in.nextInt();

            int tk = 0;
            boolean begin = true;
            int cnt = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                if (a[i] < 0) {
                    if (!begin && cnt != 0) {
                        pos.add(new Pair(i - cnt, cnt));
                    }
                    tk++;
                    cnt = 0;
                    begin = false;
                } else {
                    cnt++;
                }
            }
            if (tk > k) {
                out.println(-1);
                return;
            }

            int lastPos = -1;
            for (int i = n - 1; i >= 0; i--) {
                if (a[i] < 0) {
                    lastPos = i + 1;
                    break;
                }
            }
            if (lastPos == -1) {
                out.println(0);
                return;
            }

            for (int i = 1; i <= n; i++) {
                if (chk(i, lastPos)) {
                    out.println(i);
                    break;
                }
            }
        }

        boolean chk(int m, int last) {
            int firNeg = -1;
            for (int i = 0; i < n; i++) {
                if (a[i] < 0) {
                    firNeg = i;
                    break;
                }
            }
            if (m == 1) {
                return n - firNeg <= k;
            } else if (m == 2) {
                return last - firNeg <= k;
            } else {
                int sum = first((m - 1) / 2);

                if (m % 2 == 1) {
                    return n - firNeg - sum <= k;
                } else {
                    return last - firNeg - sum <= k;
                }
            }
        }

        int first(int x) {
            if (mem[x] != -1) return mem[x];
            int ans = 0;
            for (Pair p : pos) {
                ans += p.len;
                if (--x <= 0) break;
            }
            return mem[x] = ans;
        }

        class Pair {
            int pos;
            int len;

            public Pair(int pos, int len) {
                this.pos = pos;
                this.len = len;
            }

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.SortedSet;
import java.util.Scanner;
import java.util.Set;
import java.util.Comparator;
import java.util.TreeSet;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author heifrank
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF747D solver = new CF747D();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF747D {
        int[] a = new int[200005];
        int n;
        int k;
        SortedSet<Pair> pos = new TreeSet<>(new Comparator<Pair>() {

            public int compare(Pair o1, Pair o2) {
                return o1.len < o2.len ? 1 : -1;
            }
        });

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            k = in.nextInt();

            int tk = 0;
            boolean begin = true;
            int cnt = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                if (a[i] < 0) {
                    if (!begin && cnt != 0) {
                        pos.add(new Pair(i - cnt, cnt));
                    }
                    tk++;
                    cnt = 0;
                    begin = false;
                } else {
                    cnt++;
                }
            }
            if (tk > k) {
                out.println(-1);
                return;
            }

            int lastPos = -1;
            for (int i = n - 1; i >= 0; i--) {
                if (a[i] < 0) {
                    lastPos = i + 1;
                    break;
                }
            }
            if (lastPos == -1) {
                out.println(0);
                return;
            }

            int le = 1, ri = n, mid;
            while (le <= ri) {
                mid = (le + ri) >> 1;
                if (chk(mid, lastPos)) {
                    ri = mid - 1;
                } else {
                    le = mid + 1;
                }
            }
            out.println(le);
        }

        boolean chk(int m, int last) {
            int firNeg = -1;
            for (int i = 0; i < n; i++) {
                if (a[i] < 0) {
                    firNeg = i;
                    break;
                }
            }
            if (m == 1) {
                return n - firNeg <= k;
            } else if (m == 2) {
                return last - firNeg <= k;
            } else {
                int sum = first((m - 1) / 2);

                if (m % 2 == 1) {
                    return n - firNeg - sum <= k;
                } else {
                    return last - firNeg - sum <= k;
                }
            }
        }

        int first(int x) {
            int ans = 0;
            for (Pair p : pos) {
                ans += p.len;
                if (--x <= 0) break;
            }
            return ans;
        }

        class Pair {
            int pos;
            int len;

            public Pair(int pos, int len) {
                this.pos = pos;
                this.len = len;
            }

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.SortedSet;
import java.util.Scanner;
import java.util.Set;
import java.util.Comparator;
import java.util.TreeSet;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author heifrank
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF747D solver = new CF747D();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF747D {
        int[] a = new int[200005];
        int n;
        int k;
        SortedSet<Pair> pos = new TreeSet<>(new Comparator<Pair>() {

            public int compare(Pair o1, Pair o2) {
                return o1.len < o2.len ? 1 : -1;
            }
        });

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            k = in.nextInt();

            int tk = 0;
            boolean begin = true;
            int cnt = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                if (a[i] < 0) {
                    if (!begin && cnt != 0) {
                        pos.add(new Pair(i - cnt, cnt));
                    }
                    tk++;
                    cnt = 0;
                    begin = false;
                } else {
                    cnt++;
                }
            }
            if (tk > k) {
                out.println(-1);
                return;
            }

            int lastPos = -1;
            for (int i = n - 1; i >= 0; i--) {
                if (a[i] < 0) {
                    lastPos = i + 1;
                    break;
                }
            }
            if (lastPos == -1) {
                out.println(0);
                return;
            }

            int le = 1, ri = n, mid;
            while (le <= ri) {
                mid = (le + ri) >> 1;
                if (chk(mid, lastPos)) {
                    ri = mid - 1;
                } else {
                    le = mid + 1;
                }
            }
            out.println(le);
        }

        boolean chk(int m, int last) {
            int ans = 0;
            int tm = 1;
            Set<Integer> set = new HashSet<>();
            for (Pair p : pos) {
                if (tm + 2 <= m) {
                    set.add(p.pos);
                    tm += 2;
                } else {
                    break;
                }
            }

            int i = 0;
            while (a[i] >= 0) i++;
            while (i < last) {
                if (a[i] < 0) {
                    ans++;
                    i++;
                } else {
                    int step = 0;
                    while (a[i + step] >= 0) step++;
                    if (!set.contains(i)) {
                        ans += step;
                    }
                    i += step;
                }
            }
            return (tm + 1 <= m && ans <= k) || (ans + n - last <= k);
        }

        class Pair {
            int pos;
            int len;

            public Pair(int pos, int len) {
                this.pos = pos;
                this.len = len;
            }

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.SortedSet;
import java.util.Scanner;
import java.util.Set;
import java.util.Comparator;
import java.util.TreeSet;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author heifrank
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF747D solver = new CF747D();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF747D {
        int[] a = new int[200005];
        int n;
        int k;
        SortedSet<Pair> pos = new TreeSet<>(new Comparator<Pair>() {

            public int compare(Pair o1, Pair o2) {
                return o1.len < o2.len ? 1 : -1;
            }
        });

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            k = in.nextInt();

            int tk = 0;
            boolean begin = true;
            int cnt = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                if (a[i] < 0) {
                    if (!begin && cnt != 0) {
                        pos.add(new Pair(i - cnt, cnt));
                    }
                    tk++;
                    cnt = 0;
                    begin = false;
                } else {
                    cnt++;
                }
            }
            if (tk > k) {
                out.println(-1);
                return;
            }

            int lastPos = -1;
            for (int i = n - 1; i >= 0; i--) {
                if (a[i] < 0) {
                    lastPos = i + 1;
                    break;
                }
            }
            if (lastPos == -1) {
                out.println(0);
                return;
            }

            int le = 1, ri = n, mid;
            while (le <= ri) {
                mid = (le + ri) >> 1;
                if (chk(mid, lastPos)) {
                    ri = mid - 1;
                } else {
                    le = mid + 1;
                }
            }
            out.println(le);
        }

        boolean chk(int m, int last) {
            int ans = 0;
            int tm = 1;
            Set<Integer> set = new HashSet<>();
            for (Pair p : pos) {
                if (tm + 2 <= m) {
                    set.add(p.pos);
                    tm += 2;
                } else {
                    break;
                }
            }

            int i = 0;
            while (a[i] >= 0) i++;
            while (i < last) {
                if (a[i] < 0) {
                    ans++;
                    i++;
                } else {
                    int step = 0;
                    while (i + step < last && a[i + step] >= 0) step++;
                    if (!set.contains(i)) {
                        ans += step;
                    }
                    i += step;
                }
            }
            return (tm + 1 <= m && ans <= k) || (ans + n - last <= k);
        }

        class Pair {
            int pos;
            int len;

            public Pair(int pos, int len) {
                this.pos = pos;
                this.len = len;
            }

        }

    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;
import javafx.util.Pair;

public class D747 {

  public static void main(String[] args){
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));

    Solver solver = new Solver();
    solver.solve(in, out);
    out.close();
  }

  static class Solver {

    InputReader in;
    PrintWriter out;

    int n, k;
    int[] ts;

    List<Pair<Integer, Integer>> intervals = new ArrayList<>();

    public void solve(InputReader in, PrintWriter out) {
      this.in = in;
      this.out = out;

      n = in.readInt();
      k = in.readInt();
      ts = new int[n];
      in.readIntArray(ts);

      int winterDays = 0;
      for (int t : ts) {
        if (t < 0)
          winterDays++;
      }

      if (winterDays == 0) {
        out.print(0);
        return;
      }

      int extraDays = k - winterDays;
      if (extraDays < 0) {
        out.print(-1);
        return;
      }

      // add positive intervals
      int s = 0;
      for (int i = 0; i < ts.length; i++) {
        if (ts[i] < 0) {
          if (s >= 0) {
            // end of summer
            if (s != 0)
              intervals.add(new Pair<>(s, i - s));
            s = -1;
          } else {
            // continue winter
          }
        } else {
          if (s >= 0) {
            // continue summer
          } else {
            // begin of summer
            s = i;
          }
        }
      }
      int summerDaysInTheEnd = s > 0 ? ts.length - s : 0;

      intervals.sort(Comparator.comparingInt(Pair::getValue));

      int currentAns = intervals.size() * 2 + 2;
      for (Pair<Integer, Integer> p : intervals) {
        int il = p.getValue();

        if (extraDays >= il) {
          extraDays -= il;
          currentAns -= 2;
        } else
          break;
      }

      if (extraDays >= summerDaysInTheEnd)
        currentAns--;

      out.print(currentAns);
    }
  }

  static class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      this.reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String read() {
      try {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
          tokenizer = new StringTokenizer(reader.readLine());
        }
      } catch (IOException ex) {
        throw new RuntimeException(ex);
      }
      return tokenizer.nextToken();
    }

    public int readInt() {
      return Integer.parseInt(read());
    }

    public long readLong() {
      return Long.parseLong(read());
    }

    public void readIntArray(int[] array) {
      for (int i = 0; i < array.length; i++) {
        array[i] = readInt();
      }
    }

    public void readIntArrays(int[]... arrays) {
      for (int i = 0; i < arrays[0].length; i++) {
        for (int j = 0; j < arrays.length; j++) {
          arrays[j][i] = readInt();
        }
      }
    }
  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.*;

public class D {
    static final boolean SUMMER = false;
    static final boolean WINTER = true;
    static int numDays;
    static int winterLimit;
    static int[] temps;
    static int negativeCount;
    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
        FastScanner sc = new FastScanner();

        numDays = sc.nextInt();
        winterLimit = sc.nextInt();
//        boolean curTire = SUMMER;
        temps = sc.readIntArray(numDays);
        negativeCount = 0;
        for (int temp : temps) {
            if (temp < 0) {
                negativeCount++;
            }
        }

        suffixSums = new int[numDays];
        suffixSums[numDays - 1] = temps[numDays - 1] < 0 ? 1 : 0;
        for (int i = numDays - 2; i >= 0; i--) {
            suffixSums[i] = suffixSums[i + 1];
            if (temps[i] < 0) {
                suffixSums[i]++;
            }
        }

//        System.out.println(Arrays.toString(suffixSums));

        if (winterLimit < negativeCount) {
            System.out.println(-1);
        } else {
            int numChanges = 0;
//            List<Section> sections = new ArrayList<>();
            List<Integer> summerSections = new ArrayList<>();
            int curStart = 0;
            boolean curTireType = SUMMER;
            for (int i = 0; i < numDays; i++) {
                int temp = temps[i];
                if (temp < 0) {
                    if (curTireType == SUMMER) {
                        if (curStart > 0) {
//                            Section section = new Section(SUMMER, curStart, i - 1);
//                            sections.add(section);
                            int length = (i-1) - curStart + 1;
                            summerSections.add(length);
                        }
                        numChanges++;
                        curTireType = WINTER;
                        curStart = i;
                    }
                } else {
                    if (curTireType == WINTER) {
                        numChanges++;
                        curTireType = SUMMER;
                        curStart = i;
                    }
                }
            }

            Collections.sort(summerSections);

            int min = numChanges;

            {
                int minIfKeepLast = numChanges;
                int winterUsed = negativeCount;
                for (int sectionLength : summerSections) {
                    if (winterUsed + sectionLength <= winterLimit) {
                        winterUsed += sectionLength;
                        minIfKeepLast -= 2; // Get rid of 2 flips
                    }
                }
                min = minIfKeepLast;
            }

            if (curTireType == SUMMER) { // special case
//                Section section = new Section(SUMMER, curStart, numDays - 1);
//                if (negativeCount + section.size <= winterLimit) {
                int endLength = (numDays - 1) - curStart + 1;
                if (negativeCount + endLength <= winterLimit) {
                    int minIfFlipLast = numChanges - 1;
                    int winterUsed = negativeCount + endLength;

                    for (int sectionLength : summerSections) {
                        if (winterUsed + sectionLength <= winterLimit) {
                            winterUsed += sectionLength;
                            minIfFlipLast -= 2; // Get rid of 2 flips
                        }
                    }
                    min = Math.min(min, minIfFlipLast);
                }
            }

            System.out.println(min);
        }
    }

    static class Section implements Comparable<Section> {
        final boolean season;
        final int start, end; // inclusive
        final int size;

        public Section(boolean season, int start, int end) {
            this.season = season;
            this.start = start;
            this.end = end;
            size = end - start + 1;
        }

        @Override
        public int compareTo(Section o) {
            return Integer.compare(size, o.size);
        }

        @Override
        public String toString() {
            return "Section{" +
                    "season=" + season +
                    ", start=" + start +
                    ", end=" + end +
                    '}';
        }
    }

    static boolean check(int maxChanges) {
        int numChanges = 0;
        boolean curTires = SUMMER;
        for (int i = 0; i < numDays; i++) {
            int temp = temps[i];
            if (temp < 0) {
                if (curTires == SUMMER) {
                    numChanges++;
                }
            } else {

            }
        }

        return true;
    }

    static int[] suffixSums;
    static int suffixSum(int start) {
        if (start >= suffixSums.length) {
            return 0;
        } else {
            return suffixSums[start];
        }
    }

    static void shuffle(int[] arr) {
        Random rng = new Random();
        int length = arr.length;
        for (int idx = 0; idx < arr.length; idx++) {
            int toSwap = idx + rng.nextInt(length-idx);
            int tmp = arr[idx];
            arr[idx] = arr[toSwap];
            arr[toSwap] = tmp;
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
        long[] readLongArray(int n) {
            long[] a = new long[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextLong();
            }
            return a;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.*;

public class D {
    static final boolean SUMMER = false;
    static final boolean WINTER = true;
    static int numDays;
    static int winterLimit;
    static int[] temps;
    static int negativeCount;
    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
        FastScanner sc = new FastScanner();

        numDays = sc.nextInt();
        winterLimit = sc.nextInt();
//        boolean curTire = SUMMER;
        temps = sc.readIntArray(numDays);
        negativeCount = 0;
        for (int temp : temps) {
            if (temp < 0) {
                negativeCount++;
            }
        }

        suffixSums = new int[numDays];
        suffixSums[numDays - 1] = temps[numDays - 1] < 0 ? 1 : 0;
        for (int i = numDays - 2; i >= 0; i--) {
            suffixSums[i] = suffixSums[i + 1];
            if (temps[i] < 0) {
                suffixSums[i]++;
            }
        }

//        System.out.println(Arrays.toString(suffixSums));

        if (winterLimit < negativeCount) {
            System.out.println(-1);
        } else {
            int numChanges = 0;
//            List<Section> sections = new ArrayList<>();
            List<Integer> summerSections = new ArrayList<>();
            int curStart = 0;
            boolean curTireType = SUMMER;
            for (int i = 0; i < numDays; i++) {
                int temp = temps[i];
                if (temp < 0) {
                    if (curTireType == SUMMER) {
                        if (curStart > 0) {
//                            Section section = new Section(SUMMER, curStart, i - 1);
//                            sections.add(section);
                            int length = (i-1) - curStart + 1;
                            summerSections.add(length);
                        }
                        numChanges++;
                        curTireType = WINTER;
                        curStart = i;
                    }
                } else {
                    if (curTireType == WINTER) {
                        numChanges++;
                        curTireType = SUMMER;
                        curStart = i;
                    }
                }
            }

            Collections.sort(summerSections);

            int min = numChanges;

            {
                int minIfKeepLast = numChanges;
                int winterUsed = negativeCount;
                for (int sectionLength : summerSections) {
                    if (winterUsed + sectionLength <= winterLimit) {
                        winterUsed += sectionLength;
                        minIfKeepLast -= 2; // Get rid of 2 flips
                    }
                }
                min = minIfKeepLast;
            }

            if (curTireType == SUMMER && negativeCount > 0) { // special case
//                Section section = new Section(SUMMER, curStart, numDays - 1);
//                if (negativeCount + section.size <= winterLimit) {
                int endLength = (numDays - 1) - curStart + 1;
                if (negativeCount + endLength <= winterLimit) {
                    int minIfFlipLast = numChanges - 1;
                    int winterUsed = negativeCount + endLength;

                    for (int sectionLength : summerSections) {
                        if (winterUsed + sectionLength <= winterLimit) {
                            winterUsed += sectionLength;
                            minIfFlipLast -= 2; // Get rid of 2 flips
                        }
                    }
                    min = Math.min(min, minIfFlipLast);
                }
            }

            System.out.println(min);
        }
    }

    static class Section implements Comparable<Section> {
        final boolean season;
        final int start, end; // inclusive
        final int size;

        public Section(boolean season, int start, int end) {
            this.season = season;
            this.start = start;
            this.end = end;
            size = end - start + 1;
        }

        @Override
        public int compareTo(Section o) {
            return Integer.compare(size, o.size);
        }

        @Override
        public String toString() {
            return "Section{" +
                    "season=" + season +
                    ", start=" + start +
                    ", end=" + end +
                    '}';
        }
    }

    static boolean check(int maxChanges) {
        int numChanges = 0;
        boolean curTires = SUMMER;
        for (int i = 0; i < numDays; i++) {
            int temp = temps[i];
            if (temp < 0) {
                if (curTires == SUMMER) {
                    numChanges++;
                }
            } else {

            }
        }

        return true;
    }

    static int[] suffixSums;
    static int suffixSum(int start) {
        if (start >= suffixSums.length) {
            return 0;
        } else {
            return suffixSums[start];
        }
    }

    static void shuffle(int[] arr) {
        Random rng = new Random();
        int length = arr.length;
        for (int idx = 0; idx < arr.length; idx++) {
            int toSwap = idx + rng.nextInt(length-idx);
            int tmp = arr[idx];
            arr[idx] = arr[toSwap];
            arr[toSwap] = tmp;
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
        long[] readLongArray(int n) {
            long[] a = new long[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextLong();
            }
            return a;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class D {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt() , k = sc.nextInt();
        int t [] = new int[n];
        ArrayList<Integer> negatives = new ArrayList<>();
        for (int i = 0 ; i < n ; ++ i) {
            t[i] = sc.nextInt();
            if (t[i] < 0)
                negatives.add(i);
        }

        if (k < negatives.size()) System.out.println( - 1);
        else {
            int swaps = 0;
            ArrayList<Integer> diff = new ArrayList<>();
            for (int i = 0 ; i < negatives.size() ; ++ i)
                if (i == 0) swaps ++ ;
                else {
                    if (negatives.get(i) != negatives.get(i - 1) + 1) {
                        swaps += 2 ;
                        diff.add(negatives.get(i) - negatives.get(i - 1) - 1);
                    }
                }
            if (negatives.size() > 0 && negatives.get(negatives.size() - 1) != n - 1)
                swaps ++ ;
            Collections.sort(diff);
            k -= negatives.size();
            for (int dist : diff) {
                if (k >= dist) {
                    k -= dist;
                    swaps -= 2;
                }
            }
            if (negatives.size() > 0 && negatives.get(negatives.size() - 1) != n - 1 && k >= (n) - negatives.get(negatives.size() - 1) - 1)
                swaps --;
            System.out.println(swaps);
        }
        out.flush();
        out.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class D {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt() , k = sc.nextInt();
        int t [] = new int[n];
        ArrayList<Integer> negatives = new ArrayList<>();
        for (int i = 0 ; i < n ; ++ i) {
            t[i] = sc.nextInt();
            if (t[i] < 0)
                negatives.add(i);
        }

        if (k < negatives.size()) System.out.println( - 1);
        else {
            int swaps = 0;
            ArrayList<Integer> diff = new ArrayList<>();
            for (int i = 0 ; i < negatives.size() ; ++ i)
                if (i == 0) swaps ++ ;
                else {
                    if (negatives.get(i) != negatives.get(i - 1) + 1) {
                        swaps += 2 ;
                        diff.add(negatives.get(i) - negatives.get(i - 1) - 1);
                    }
                }
            if (negatives.get(negatives.size() - 1) != n - 1)
                swaps ++ ;
            Collections.sort(diff);
            k -= negatives.size();
            for (int dist : diff) {
                if (k >= dist) {
                    k -= dist;
                    swaps -= 2;
                }
            }
            if (negatives.get(negatives.size() - 1) != n - 1 && k >= (n) - negatives.get(negatives.size() - 1) - 1)
                swaps --;
            System.out.println(swaps);
        }
        out.flush();
        out.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        d747 solver = new d747();
        solver.solve(1, in, out);
        out.close();
    }

    static class d747 {
        TreeMap<Integer, ArrayList<seg>> posSegs;
        ArrayList<seg> border = new ArrayList<>();
        int n;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            int k = in.nextInt();
            int[] t = new int[n];
            boolean[] winter = new boolean[n];
            seg cur = null;
            posSegs = new TreeMap<>();
            for (int i = 0; i < n; i++) {
                t[i] = in.nextInt();
                if (t[i] < 0) {
                    winter[i] = true;
                    k--;
                    add(cur);
                    cur = null;
                } else {
                    if (cur == null) {
                        cur = new seg();
                        cur.l = i;
                    }
                    cur.r = i;
                }
            }
            add(cur);
            if (k < 0) {
                out.println(-1);
                return;
            }
            loop:
            {
                for (int len : posSegs.keySet()) {
                    for (seg s : posSegs.get(len)) {
                        if (k >= len) {
                            for (int i = s.l; i <= s.r; i++) {
                                winter[i] = true;
                            }
                            k -= len;
                        } else break loop;
                    }
                }
            }
            if (!border.isEmpty()) {
                int len = border.get(0).r - border.get(0).l + 1;
                if (k >= len) {
                    for (int i = border.get(0).l; i <= border.get(0).r; i++) {
                        winter[i] = true;
                    }
                    k -= len;
                }
            }
            boolean isWinter = false;
            int ans = 0;
            for (int i = 0; i < n; i++) {
                if (isWinter != winter[i]) {
                    isWinter = winter[i];
                    ans++;
                }
            }
            out.println(ans);
        }

        void add(seg s) {
            if (s == null) return;
            if (s.l == 0) return;
            if (s.r == n - 1) {
                border.add(s);
                return;
            }
            if (!posSegs.containsKey(s.r - s.l + 1)) {
                posSegs.put(s.r - s.l + 1, new ArrayList<>());
            }
            posSegs.get(s.r - s.l + 1).add(s);
        }

        class seg {
            int l;
            int r;

        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        d747 solver = new d747();
        solver.solve(1, in, out);
        out.close();
    }

    static class d747 {
        TreeMap<Integer, ArrayList<seg>> posSegs;
        ArrayList<seg> border;
        int n;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            int k = in.nextInt();
            int[] t = new int[n];
            boolean[] winter = new boolean[n];
            seg cur = null;
            posSegs = new TreeMap<>();
            for (int i = 0; i < n; i++) {
                t[i] = in.nextInt();
                if (t[i] < 0) {
                    winter[i] = true;
                    k--;
                    add(cur);
                    cur = null;
                } else {
                    if (cur == null) {
                        cur = new seg();
                        cur.l = i;
                    }
                    cur.r = i;
                }
            }
            add(cur);
            if (k < 0) {
                out.println(-1);
                return;
            }
            loop:
            {
                for (int len : posSegs.keySet()) {
                    for (seg s : posSegs.get(len)) {
                        if (k >= len) {
                            for (int i = s.l; i <= s.r; i++) {
                                winter[i] = true;
                            }
                            k -= len;
                        } else break loop;
                    }
                }
            }
            if (!border.isEmpty() && !posSegs.isEmpty()) {
                int len = border.get(0).r - border.get(0).l + 1;
                if (k >= len) {
                    for (int i = border.get(0).l; i <= border.get(0).r; i++) {
                        winter[i] = true;
                    }
                    k -= len;
                }
            }
            boolean isWinter = false;
            int ans = 0;
            for (int i = 0; i < n; i++) {
                if (isWinter != winter[i]) {
                    isWinter = winter[i];
                    ans++;
                }
            }
            out.println(ans);
        }

        void add(seg s) {
            if (s == null) return;
            if (s.l == 0) return;
            if (s.r == n - 1) {
                if (border == null) border = new ArrayList<>();
                border.add(s);
                return;
            }
            if (!posSegs.containsKey(s.r - s.l + 1)) {
                posSegs.put(s.r - s.l + 1, new ArrayList<>());
            }
            posSegs.get(s.r - s.l + 1).add(s);
        }

        class seg {
            int l;
            int r;

        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        d747 solver = new d747();
        solver.solve(1, in, out);
        out.close();
    }

    static class d747 {
        TreeMap<Integer, ArrayList<seg>> posSegs;
        ArrayList<seg> border = new ArrayList<>();
        int n;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            int k = in.nextInt();
            int[] t = new int[n];
            boolean[] winter = new boolean[n];
            seg cur = null;
            posSegs = new TreeMap<>();
            for (int i = 0; i < n; i++) {
                t[i] = in.nextInt();
                if (t[i] < 0) {
                    winter[i] = true;
                    k--;
                    add(cur);
                    cur = null;
                } else {
                    if (cur == null) {
                        cur = new seg();
                        cur.l = i;
                    }
                    cur.r = i;
                }
            }
            add(cur);
            if (k < 0) {
                out.println(-1);
                return;
            }
            loop:
            {
                for (int len : posSegs.keySet()) {
                    for (seg s : posSegs.get(len)) {
                        if (k >= len) {
                            for (int i = s.l; i <= s.r; i++) {
                                winter[i] = true;
                            }
                            k -= len;
                        } else break loop;
                    }
                }
            }
            if (!border.isEmpty() && !posSegs.isEmpty()) {
                int len = border.get(0).r - border.get(0).l + 1;
                if (k >= len) {
                    for (int i = border.get(0).l; i <= border.get(0).r; i++) {
                        winter[i] = true;
                    }
                    k -= len;
                }
            }
            boolean isWinter = false;
            int ans = 0;
            for (int i = 0; i < n; i++) {
                if (isWinter != winter[i]) {
                    isWinter = winter[i];
                    ans++;
                }
            }
            out.println(ans);
        }

        void add(seg s) {
            if (s == null) return;
            if (s.l == 0) return;
            if (s.r == n - 1) {
                border.add(s);
                return;
            }
            if (!posSegs.containsKey(s.r - s.l + 1)) {
                posSegs.put(s.r - s.l + 1, new ArrayList<>());
            }
            posSegs.get(s.r - s.l + 1).add(s);
        }

        class seg {
            int l;
            int r;

        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class K implements Runnable {

  public static void main(String[] args) {
    new Thread(null, new K(), "", 1 << 28).start();
  }

  static int n;
  static int k;
  static int[] t;

  public void run() {
    FastScanner sc = new FastScanner();
    n = sc.nextInt();
    k = sc.nextInt();
    t = sc.intArray(n);
    memo = new int[2][n + 1];

    ref ref = new ref(k);
    int swap = solve(ref);
    if (swap < 0) {
      System.out.println(-1);
      return;
    }

    int leftover = ref.k;

    Queue<Gap> gaps = new PriorityQueue<>();
    Gap g = null;
    int i = 0;
    boolean summer = true;
    while (i < n) {
      if (t[i] >= 0) {
        if (g == null && !summer) {
          g = new Gap();
          g.s = i;
        }
        summer = true;
      } else {
        summer = false;
        if (g != null) {
          g.e = i;
          gaps.offer(g);
          g = null;
        }
      }
      i++;
    }
    if (g != null) {
      g.e = n;
      gaps.offer(g);
    }

    while (leftover > 0 && gaps.peek().e - gaps.peek().s <= leftover) {
      Gap qq = gaps.poll();
      leftover -= (qq.e - qq.s);

      if (qq.e == n)
        swap -= 1;
      else
        swap -= 2;
    }

    System.out.println(swap);

  }

  static int[][] memo;

  static int solve(ref ref) {
    if (ref.day == n) {
      return 0;
    }
    if (k == 0 && t[ref.day] < 0) {
      return Integer.MIN_VALUE;
    }

    if (ref.summer && t[ref.day] < 0) {
      ref.summer = false;
      ref.day += 1;
      ref.k -= 1;
      return solve(ref) + 1;
    } else if (!ref.summer && t[ref.day] < 0) {
      ref.summer = false;
      ref.day += 1;
      ref.k -= 1;
      return solve(ref);
    } else if (ref.summer && t[ref.day] >= 0) {
      ref.summer = true;
      ref.day += 1;
      return solve(ref);
    } else {
      ref.summer = true;
      ref.day += 1;
      return solve(ref) + 1;
    }
  }

  static class ref {
    boolean summer;
    int day;
    int k;

    ref(int k) {
      summer = true;
      day = 0;
      this.k = k;
    }
  }

  static class Gap implements Comparable<Gap> {
    int s, e;

    @Override
    public int compareTo(Gap other) {

      int res = Integer.compare(e - s, other.e - other.s);
      if (res == 0) {
        return Integer.compare(e, other.e);
      } else {
        return res;
      }
    }
  }

  class FastScanner {
    BufferedReader reader;
    StringTokenizer tokenizer;

    FastScanner() {
      reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
      tokenizer = null;
    }

    String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    int[] intArray(int size) {
      int[] ret = new int[size];
      for (int i = 0; i < size; i++) {
        ret[i] = nextInt();
      }
      return ret;
    }

    String[] stringArray(int size) {
      String[] ret = new String[size];
      for (int i = 0; i < size; i++) {
        ret[i] = next();
      }
      return ret;
    }
  }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class K implements Runnable {

  public static void main(String[] args) {
    new Thread(null, new K(), "", 1 << 28).start();
  }

  static int n;
  static int k;
  static int[] t;

  public void run() {
    FastScanner sc = new FastScanner();
    n = sc.nextInt();
    k = sc.nextInt();
    t = sc.intArray(n);
    memo = new int[2][n + 1];

    ref ref = new ref(k);
    int swap = solve(ref);
    if (swap < 0) {
      System.out.println(-1);
      return;
    }

    int leftover = ref.k;
    if (leftover < 0) {
      System.out.println(-1);
      return;
    }

    Queue<Gap> gaps = new PriorityQueue<>();
    Gap g = null;
    int i = 0;
    boolean summer = true;
    while (i < n) {
      if (t[i] >= 0) {
        if (g == null && !summer) {
          g = new Gap();
          g.s = i;
        }
        summer = true;
      } else {
        summer = false;
        if (g != null) {
          g.e = i;
          gaps.offer(g);
          g = null;
        }
      }
      i++;
    }
    if (g != null) {
      g.e = n;
    }

    while (leftover > 0 && !gaps.isEmpty() && gaps.peek().e - gaps.peek().s <= leftover) {
      Gap qq = gaps.poll();
      leftover -= (qq.e - qq.s);
      swap -= 2;
    }

    if (g.e - g.s <= leftover) {
      swap -= 1;
    }

    System.out.println(swap);

  }

  static int[][] memo;

  static int solve(ref ref) {
    if (ref.day == n) {
      return 0;
    }
    if (k == 0 && t[ref.day] < 0) {
      return Integer.MIN_VALUE;
    }

    if (ref.summer && t[ref.day] < 0) {
      ref.summer = false;
      ref.day += 1;
      ref.k -= 1;
      return solve(ref) + 1;
    } else if (!ref.summer && t[ref.day] < 0) {
      ref.summer = false;
      ref.day += 1;
      ref.k -= 1;
      return solve(ref);
    } else if (ref.summer && t[ref.day] >= 0) {
      ref.summer = true;
      ref.day += 1;
      return solve(ref);
    } else {
      ref.summer = true;
      ref.day += 1;
      return solve(ref) + 1;
    }
  }

  static class ref {
    boolean summer;
    int day;
    int k;

    ref(int k) {
      summer = true;
      day = 0;
      this.k = k;
    }
  }

  static class Gap implements Comparable<Gap> {
    int s, e;

    @Override
    public int compareTo(Gap other) {

      int res = Integer.compare(e - s, other.e - other.s);
      if (res == 0) {
        return Integer.compare(e, other.e);
      } else {
        return res;
      }
    }
  }

  class FastScanner {
    BufferedReader reader;
    StringTokenizer tokenizer;

    FastScanner() {
      reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
      tokenizer = null;
    }

    String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    int[] intArray(int size) {
      int[] ret = new int[size];
      for (int i = 0; i < size; i++) {
        ret[i] = nextInt();
      }
      return ret;
    }

    String[] stringArray(int size) {
      String[] ret = new String[size];
      for (int i = 0; i < size; i++) {
        ret[i] = next();
      }
      return ret;
    }
  }
}