import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException, InterruptedException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		static boolean visited[]  ;
		static boolean found = false;

		static int steps = 0 ;
		static int n ;
		static boolean memo [][] ;
		static int dp[][] ;
		static char matrix[][] ;
		static ArrayList<Integer> p  ;
		public void solve(int testNumber, InputReader in, PrintWriter out) throws IOException, InterruptedException {

			int n = in.nextInt() ;
			int k =in.nextInt() ;

			int a[] =  new int[n] ;
			int c=0 ;
			for (int i = 0; i < a.length; i++)
			{
				a[i]=in.nextInt();
				if(a[i]<0)
					c++;
			}

			if(c==0)
			{
				System.out.println(0);
				return ;
			}
			if(k==0)
			{
				System.out.println(-1);
				return ;
			}

			if(k<c)
				System.out.println(-1);
			else if (k==c)
			{
				int changes=0 ;
				boolean summer= true ;
				for (int i = 0; i < a.length; i++)
					if(a[i]<0 && summer)
					{
						changes ++;
						summer = false ;
					}else if (a[i]>=0 && !summer)
					{
						changes ++ ;
						summer = true ;
					}else continue ;

				System.out.println(changes);
			}
			else
			{
				int x=k-c ;
				int begin =0 ;
				for (int i = 0; i < a.length; i++)
					if(a[i]<0){begin = i ; break ;}
				ArrayList<pair2> pos = new ArrayList<pair2>() ;

				for (int i = begin; i < a.length; i++)
				{
					if(a[i]>=0)
					{
						int d=1 ;
						int end = i+1 ;
						for (int j = i+1; j < a.length; j++)
						{
							if(a[j]>=0){d++; end = j ;} else {end =j ; break ;}
						}
						pair2 now = new pair2(d,false) ;
						if(end ==n || end==n-1) now.last=true ;
						pos.add(now);
						i=end ;
					}
				}

				System.err.println("pos");
				for (int i = 0; i < pos.size(); i++)
				{
					System.err.println(pos.get(i).i+" "+pos.get(i).last);
				}
				Collections.sort(pos);
				System.err.println("pos");

				int min1 =0 ;
				int min2 =0 ;

				int xx =x ;
				System.err.println(x+"x");
				for (int i = 0; i < pos.size(); i++)
				{
					if(x>=pos.get(i).i)
					{
						min1 +=2 ;
						x-=pos.get(i).i ;
						if(pos.get(i).last==true) min1--;
					}else {break;}
				}
				for (int i = 0; i < pos.size(); i++)
				{
					if(xx>=pos.get(i).i && pos.get(i).last==false)
					{
						min2+=2 ;
						xx-=pos.get(i).i ;
					}else {break;}
				}
				System.err.println("com mins");
				System.err.println(min2);
				System.err.println(min1);
				min1 = Math.max(min1, min2) ;

				int changes=0 ;
				boolean summer= true ;
				for (int i = 0; i < a.length; i++)
					if(a[i]<0 && summer)
					{
						changes ++;
						summer = false ;
					}else if (a[i]>=0 && !summer)
					{
						changes ++ ;
						summer = true ;
					}else continue ;

				System.err.println(changes);
				changes -= min1 ;
				System.out.println(changes);

			}

			//				int rem= k  ;
			//				int need[] =  new int[n] ;
			//
			//				if(a[n-1]<0) need[n-1]=1 ;
			//				else need[n-1]=0 ;
			//
			//				for (int i = n-2; i >=0; i--)
			//				{
			//					if(a[i]<0)need[i]=need[i+1]+1 ;
			//					else need[i]=need[i+1] ;
			//
			//					//System.err.println(a[i]+"AA"+need[i]);
			//				}
			//
			//				for (int i = 0; i < need.length; i++)
			//				{
			//					System.err.print(need[i]+" ");
			//				}
			//				boolean summer= true ;
			//				int changes =0 ;
			//
			//				if(a[0]<0){summer = false ; rem -- ; changes++ ;}
			//
			//				for (int i = 1; i < n; i++)
			//				{
			//					if(a[i]<0 && summer)
			//					{
			//						changes ++ ;
			//						System.err.println("her"+i);
			//						summer = false  ;
			//						rem -- ;
			//					}else if(a[i]<0 && !summer){ rem -- ;}
			//					else if (a[i]>=0 && summer){continue ; }
			//					else {
			//						if(rem > need[i])
			//						{
			//							rem-- ;
			//						}else {summer = true ; changes ++ ; System.err.println("h"+i); }
			//					}
			//				}
			//
			//				System.out.println(changes);

		}

		public static int cnt1(int mat[][])  //how many swaps to be a 1 matrix
		{
			int m = mat.length ;
			int c=0 ;
			for (int i = 0; i < mat.length; i++)
			{
				for (int j = 0; j < mat.length; j++)
				{
					int x =  (i*m) +j ;
					if(x%2==0 && mat[i][j]==0)
						c++;
					if(x%2!=0 && mat[i][j]==1)
						c++;

				}
			}
			return c;
		}
		public static int cnt0(int mat[][])
		{
			int m = mat.length ;
			int c=0 ;
			for (int i = 0; i < mat.length; i++)
			{
				for (int j = 0; j < mat.length; j++)
				{
					int x =  (i*m) +j ;
					if(x%2!=0 && mat[i][j]==0)
						c++;
					if(x%2==0 && mat[i][j]==1)
						c++;

				}
			}
			return c;
		}

		public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){
			if(x1==x2)
				if(x1==x3)
					return true ;
				else
					return false ;
			else
				if(x1==x3)
					return false ;
				else
				{
					long a = 1l*(y2-y1)*(x3-x2) ;
					long b = 1l*(y3-y2)*(x2-x1) ;

					if(a==b)
						return true;
					else
						return false ;

				}

		}
		public static void shuffle(int c[]){
			if(c.length==1)
				return ;
			for (int i = 0; i < c.length; i++)
			{
				Random rand = new Random();

				int  n = rand.nextInt(c.length-1) + 0;

				int temp = c[i] ;
				c[i] = c[n] ;
				c[n] = temp ;
			}
		}
		public static int binary(long[]arr, int l, int r, long x)   /// begin by 0 and n-1
		{
			if (r>=l)
			{
				int mid = l + (r - l)/2;
				if (arr[mid]== x)
					return mid;
				if (arr[mid]> x)
					return binary(arr, l, mid-1, x);
				return binary(arr, mid+1, r, x);
			}
			return -1;
		}

		/// searching for the index of first elment greater than x
		public static int binary1(long[]arr , long x) {
			int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
			while (low != high) {
				int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
				if (arr[mid] <= x) {
					/* This index, and everything below it, must not be the first element
					 * greater than what we're looking for because this element is no greater
					 * than the element.
					 */
					low = mid + 1;
				}
				else {
					/* This element is at least as large as the element, so anything after it can't
					 * be the first element that's at least as large.
					 */
					high = mid;
				}
			}
			return low ; // return high ;
		}

		private static boolean triangle(int a, int b , int c){
			if(a+b>c && a+c>b && b+c>a)
				return true ;
			else
				return false ;
		}
		private static boolean segment(int a, int b , int c){
			if(a+b==c || a+c==b && b+c==a)
				return true ;
			else
				return false ;
		}
		private static int gcdThing(long a, long b) {
			BigInteger b1 = BigInteger.valueOf(a);
			BigInteger b2 = BigInteger.valueOf(b);
			BigInteger gcd = b1.gcd(b2);
			return gcd.intValue();
		}

		public static boolean is(int i){
			if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))
				return true ;
			if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )
				return true ;
			if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )
				return true ;

			return false;

		}
		public static boolean contains(int b[] , int x)
		{
			for (int i = 0; i < b.length; i++)
			{
				if(b[i]==x)
					return true ;
			}
			return false ;
		}
		public static int binary(long []arr , long target , int low , long shift) {
			int high = arr.length;
			while (low != high) {
				int mid = (low + high) / 2;
				if (arr[mid]-shift <= target) {
					low = mid + 1;
				}
				else {
					high = mid;
				}
			}
			return low ; // return high ;
		}
		public static boolean isLetter(char x){
			if(x+0 <=122 && x+0 >=97 )
				return true ;
			else if (x+0 <=90 && x+0 >=65 )
				return true ;
			else return false;
		}
		public static long getPrimes(long x ){
			if(x==2 || x==3 || x==1)
				return 2 ;
			if(isPrime(x))
				return 5 ;
			for (int i = 2; i*i<=x; i++)
			{
				if(x%i==0 && isPrime(i))
					return getPrimes(x/i) ;
			}
			return -1;
		}
		public static String solve(String x){

			int n = x.length() ;
			String y = "" ;
			for (int i = 0; i < n-2; i+=2)
			{
				if(ifPalindrome(x.substring(i, i+2)))
					y+= x.substring(i, i+2) ;
				else
					break ;
			}
			return y+ solve1(x.substring(y.length(),x.length())) ;

		}
		public static String solve1(String x){
			String y = x.substring(0 , x.length()/2) ;
			return "" ;

		}
		public static String reverse(String x){
			String y ="" ;
			for (int i = 0; i < x.length(); i++)
			{
				y  = x.charAt(i) + y ;
			}
			return y ;
		}

		public static boolean ifPalindrome(String x){
			int numbers[] = new int[10] ;
			for (int i = 0; i < x.length(); i++)
			{
				int z = Integer.parseInt(x.charAt(i)+"") ;
				numbers[z] ++ ;
			}
			for (int i = 0; i < numbers.length; i++)
			{
				if(numbers[i]%2!=0)
					return false;
			}
			return true ;
		}

		public static int get(int n){
			return n*(n+1)/2 ;
		}
		//		public static long getSmallestDivisor( long y){
		//			if(isPrime(y))
		//				return -1;
		//
		//			for (long i = 2; i*i <= y; i++)
		//			{
		//				if(y%i ==0)
		//				{
		//					return i;
		//				}
		//			}
		//			return -1;
		//		}
		//		public static void lis(pair []a , int n){
		//			int lis[] = new int[n] ;
		//			Arrays.fill(lis,1) ;
		//
		//			for(int i=1;i<n;i++)
		//				for(int j=0 ; j<i; j++)
		//					if (a[i].y>a[j].y &&  lis[i] < lis[j]+1)
		//						lis[i] = lis[j] + 1;
		//
		//			int max = lis[0];
		//
		//			for(int i=1; i<n ; i++)
		//				if (max < lis[i])
		//					max = lis[i] ;
		//			System.out.println(max);
		//
		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --;
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
		//			return  ;
		//		}
		public static int calcDepth(Vertix node){
			if(node.depth>0) return node.depth;
			// meaning it has been updated before;
			if(node.parent != null)
				return 1+ calcDepth(node.parent);
			else
				return -1;
		}

		public static boolean isPrime (long num){
			if (num < 2) return false;
			if (num == 2) return true;
			if (num % 2 == 0) return false;
			for (int i = 3; i * i <= num; i += 2)
				if (num % i == 0) return false;
			return true;
		}

		public static int[] getDiv(int n)
		{
			int result[] = new int[7] ;
			ArrayList<Integer>  f = new ArrayList<Integer>() ;

			while (n%2==0)
			{
				if(!f.contains(2))f.add(2) ;
				n /= 2;
			}

			// n must be odd at this point.  So we can
			// skip one element (Note i = i +2)
			for (int i = 3; i <= Math.sqrt(n); i+= 2)
			{
				// While i divides n, print i and divide n
				while (n%i == 0)
				{
					if(!f.contains(i))f.add(i);
					n /= i;
				}
			}

			// This condition is to handle the case whien
			// n is a prime number greater than 2
			if (n > 2)
				if(!f.contains(n))f.add(n);

			for (int i = 0, j=0; i < f.size(); i++)
			{
				result[j++]=f.get(i);
			}
			return result ;

		}

		//		public static boolean dfs(Vertix v , int target){
		//			try{
		//				visited[v.i]= true ;
		//			} catch (NullPointerException e)
		//			{
		//				System.out.println(v.i);
		//			}
		//			if(v.i == target)
		//
		//				return true ;
		//			for (int i =0 ; i< v.neighbours.size() ; i++)
		//			{
		//
		//				Vertix child = v.neighbours.get(i) ;
		//				if(child.i == target){
		//					found = true  ;
		//				}
		//				if(visited[child.i]==false){
		//					found |= dfs(child, target) ;
		//				}
		//			}
		//			return found;
		//		}

	}
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

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

	}
	public static class Vertix{
		long i ;
		int depth ;
		ArrayList<Vertix> neighbours ;
		Vertix parent ;
		Vertix child ;

		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair>{
		int i ;
		int r ;
		int qless  ; /// is his quarrel has skill less than him

		public pair(int x, int y ,int z){
			this.i=x ;
			this.r=y ;
			this .qless =z ;

		}

		@Override
		public int compareTo(pair p) {
			if(this.r > p.r)
				return 1 ;
			else if(this.r == p.r) return 0 ;
			else return -1 ;

		}

	}

	public static class pair2 implements Comparable<pair2>{
		int i ;
		boolean last ;

		public pair2(int i , boolean result){
			this.i =i ;
			this.last = result ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.i > p.i)
				return 1 ;
			else if (this.i == p.i) return 0 ;
			else
				return -1 ;
		}

	}

}


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

public class CO_747D
{
	static int imax=Integer.MAX_VALUE,imin=Integer.MIN_VALUE;
	static long lmax=Long.MAX_VALUE,lmin=Long.MIN_VALUE;
	static long mod=(long)1e9+7;
	public static void main (String[] args) throws java.lang.Exception
	{
		InputReader in =new InputReader(System.in);
		PrintWriter out=new PrintWriter(System.out);
//		int test=in.nextInt();
 		int test=1;
 		int i=0,j=0;
		while(test-->0){
			int n=in.nextInt();
			int k=in.nextInt();
			int arr[]=new int[n];
			int cnt=0;
			for(i=0;i<n;i++){
				arr[i]=in.nextInt();
				if(arr[i]<0)cnt++;
			}
			if(k<cnt){
				System.out.println("-1");
				return;
			}
			i=0;
			while(i<n&&arr[i]>=0)i++;
			if(i==n){
				System.out.println("0");
				return;
			}
			int start,end,num=1,last=0;
			ArrayList<Pair> list=new ArrayList<>();
			ArrayList<Pair> list1=new ArrayList<>();
			while(i<n){
				if(i<n&&arr[i]<0)i++;
				if(i==n)break;
				start=i;
				while(i<n&&arr[i]>=0)i++;
				end=i;
				if(i!=n){
					list.add(new Pair(num,++num,end-start));
				}else if(i==n){
					last=n-start;
				}
			}
			Collections.sort(list,new Comparator<Pair>(){
				public int compare(Pair ob1,Pair ob2){
					if(ob1.dist==ob2.dist){
						return ob1.start-ob2.start;
					}else{
						return ob1.dist-ob2.dist;
					}
				}
			});
			int extra=k-cnt;
			for(i=0;i<list.size();i++){
				if(extra-list.get(i).dist<0)break;
				extra-=list.get(i).dist;
				list1.add(list.get(i));
			}
			Collections.sort(list1,new Comparator<Pair>(){
				public int compare(Pair ob1,Pair ob2){
					return ob1.start-ob2.start;
				}
			});
			end=-1;
			int part=0,neg=0;
			for(i=0;i<list1.size();i++){
				Pair ob=list.get(i);
				if(ob.start==end){
					neg++;
					end=ob.end;
				}else{
					neg+=2;
					part++;
					end=ob.end;
				}
			}
			int ans=part*2+(cnt-neg)*2;
			if(extra-last>=0)
				ans--;
//			out.println(list);
			out.println(ans);
		}
	out.close();
	}

	static class Pair{
		int start,end,dist;
		Pair(int start,int end,int dist){
			this.start=start;
			this.end=end;
			this.dist=dist;
		}
		public String toString(){
			return start+" "+end+" "+dist+"\n";
		}
	}
	static void print(long arr[],int len){
		for(int i=0;i<len;i++)
		System.out.print(arr[i]+" ");
		System.out.println();
	}
	static class InputReader
	{

	    private InputStream stream;
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;

	    public InputReader(InputStream stream) {
	        this.stream = stream;
	    }

	    public int read() {
	        if (numChars == -1)
	            throw new InputMismatchException();
	        if (curChar >= numChars) {
	            curChar = 0;
	            try {
	                numChars = stream.read(buf);
	            } catch (IOException e) {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0)
	                return -1;
	        }
	        return buf[curChar++];
	    }

	    public int nextInt() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        int sgn = 1;
	        if (c == '-') {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do {
	            if (c < '0' || c > '9')
	                throw new InputMismatchException();
	            res *= 10;
	            res += c & 15;
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        int sgn = 1;
	        if (c == '-') {
	            sgn = -1;
	            c = read();
	        }
	        long res = 0;
	        do {
	            if (c < '0' || c > '9')
	                throw new InputMismatchException();
	            res *= 10;
	            res += c & 15;
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public String next() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        StringBuilder res = new StringBuilder();
	        do {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    public String nextLine() {
	        int c = read();
	        //while (c != '\n' && c != '\r' && c != '\t' && c != -1)
	        //c = read();
	        StringBuilder res = new StringBuilder();
	        do {
	            res.appendCodePoint(c);
	            c = read();
	        } while (c != '\n' && c != '\r' && c != '\t' && c != -1);
	        return res.toString();
	    }

	    public static boolean isSpaceChar(int c) {
	        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	    }

	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
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);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();

            int T[] = new int[N];
            for (int i = 0; i < N; i++) {
                T[i] = in.nextInt();
            }
            TreeSet<TaskD.Przedzial> prz = new TreeSet<>();
            int negs = 0;
            int last = -1;
            int pos = 0;
            for (int i = 0; i < N; i++) {
                if (T[i] < 0) {
                    if (last == -1) {
                        last = i;
                    } else {
                        int length = i - last + 1;
                        prz.add(new TaskD.Przedzial(last, length));
                        pos += length - 2;
                        last = i;
                    }
                    negs++;
                }
            }

            TaskD.Przedzial special = null;

            if (last < T.length - 1) {
                special = new TaskD.Przedzial(T.length, T.length - last + 1);
                pos += special.length - 2;
            }

            if (negs > K) {
                out.println(-1);
                return;
            } else {
                if (negs == 0) {
                    out.println(0);
                    return;
                }

                int ans = 1;
                while (pos + negs > K) {
                    if (special != null && (pos + negs) - K <= special.length - 2) {
                        ans++;
                        out.println(ans);
                        return;
                    }

                    TaskD.Przedzial p = prz.pollLast();
                    pos -= (p.length - 2);
                    ans += 2;
                }
                out.println(ans);
            }
        }

        private static class Przedzial implements Comparable<TaskD.Przedzial> {
            private int idx;
            private int length;

            public Przedzial(int idx, int length) {
                this.idx = idx;
                this.length = length;
            }

            public int compareTo(TaskD.Przedzial that) {
                if (this.length < that.length) return -1;
                if (this.length > that.length) return 1;
                return this.idx - that.idx;
            }

        }

    }

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

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.AbstractCollection;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.Comparator;
import java.io.InputStream;
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alex
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskD {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt(), k = in.readInt();
            int[] input = IOUtils.readIntArray(in, n);
            ArrayList<Boolean> summer = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                if (input[i] >= 0) {
                    if (!summer.isEmpty()) {
                        summer.add(true);
                    }
                } else {
                    summer.add(false);
                }
            }
            PriorityQueue<E> pq = new PriorityQueue<>(new Comparator<E>() {
                public int compare(E a, E b) {
                    if (a.len != b.len) return -Integer.compare(a.len, b.len);
                    return -Integer.compare(a.idx, b.idx);
                }
            });
            for (int idx = 0; idx < summer.size(); ) {
                boolean isSummer = summer.get(idx);
                if (isSummer) {
                    E e = new E(idx);
                    for (int i = idx; i < summer.size(); i++) {
                        if (!summer.get(i)) break;
                        e.len++;
                    }
                    pq.add(e);
                    idx += e.len;
                } else idx++;
            }
            int currently = summer.size();
            int res = summer.isEmpty() ? 0 : 1;
            int last = 0;
            while (currently > k && !pq.isEmpty()) {
                E e = pq.poll();
                last = e.len;
                currently -= e.len;
                res += 2;
                if (e.idx + e.len == summer.size()) res--;
            }
            if (currently > k) {
                out.printLine(-1);
                return;
            }
            while (!pq.isEmpty()) {
                E e = pq.poll();
                if (e.idx + e.len == summer.size()) {
                    if (last > 0 && currently + last - e.len <= k) {
                        res--;
                        break;
                    }
                }
            }
            out.printLine(res);
        }
        class E {
            int idx;
            int len = 0;
            public E(int idx) {
                this.idx = idx;
            }
        }
    }
    static class OutputWriter {
        private final PrintWriter writer;
        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }
        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }
        public void close() {
            writer.close();
        }
        public void printLine(int i) {
            writer.println(i);
        }
    }
    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;
        public InputReader(InputStream stream) {
            this.stream = stream;
        }
        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }
        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Queue;
import java.io.BufferedReader;
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;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            int[] data = in.getALineOfInts(2);
            int n = data[0];
            int k = data[1];
            int[] t = in.getALineOfInts(n);

            Queue<TaskD.Gap> gaps = new PriorityQueue<>();

            int numNeg = 0;
            for (int i = 0; i < n; i++) {
                if (t[i] < 0) {
                    numNeg++;
                }
            }

            if (numNeg > k) {
                out.println("-1");
                return;
            }

            int start = 0;
            while (start < n && t[start] >= 0) {
                start++;
            }

            int last = start;
            int j = start + 1;
            for (; j < n; j++) {
                if (t[j] < 0 && t[j - 1] >= 0) {
                    gaps.add(new TaskD.Gap(j - last - 1, false));
                }

                if (t[j] < 0) {
                    last = j;
                }
            }

            if (n - last > 1) {
                gaps.add(new TaskD.Gap(n - last - 1, true));
            }

            int rem = k - numNeg;
            while (rem > 0 && !gaps.isEmpty()) {
                TaskD.Gap nextGap = gaps.poll();
                int next = nextGap.size;
                if (next > rem) {
                    gaps.add(nextGap);
                    break;
                } else {
                    rem -= next;
                }
            }

            int qsize = gaps.size();
            boolean lastExi = false;
            while (!gaps.isEmpty()) {
                TaskD.Gap g = gaps.poll();
                if (g.last) {
                    lastExi = true;
                    break;
                }
            }

            int res = 1 + qsize * 2;
            if (lastExi) {
                res--;
            }
            out.println(res);

        }

        static class Gap implements Comparable<TaskD.Gap> {
            private final int size;
            private final boolean last;

            public Gap(int size, boolean last) {
                this.size = size;
                this.last = last;
            }

            public int compareTo(TaskD.Gap o) {
                int res = size - o.size;
                if (res != 0) {
                    return res;
                } else {
                    if (last == o.last) {
                        return 0;
                    } else if (last) {
                        return 1;
                    } else {
                        return -1;
                    }
                }
            }

        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public int[] getALineOfInts(int numExpected) {
            int[] res = new int[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Integer.parseInt(st.nextToken());
            return res;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Queue;
import java.io.BufferedReader;
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;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            int[] data = in.getALineOfInts(2);
            int n = data[0];
            int k = data[1];
            int[] t = in.getALineOfInts(n);

            Queue<TaskD.Gap> gaps = new PriorityQueue<>();

            int numNeg = 0;
            for (int i = 0; i < n; i++) {
                if (t[i] < 0) {
                    numNeg++;
                }
            }

            if (numNeg > k) {
                out.println("-1");
                return;
            }

            if (numNeg == 0) {
                out.println(0);
                return;
            }

            int start = 0;
            while (start < n && t[start] >= 0) {
                start++;
            }

            int last = start;
            int j = start + 1;
            for (; j < n; j++) {
                if (t[j] < 0 && t[j - 1] >= 0) {
                    gaps.add(new TaskD.Gap(j - last - 1, false));
                }

                if (t[j] < 0) {
                    last = j;
                }
            }

            if (n - last > 1) {
                gaps.add(new TaskD.Gap(n - last - 1, true));
            }

            int rem = k - numNeg;
            while (rem > 0 && !gaps.isEmpty()) {
                TaskD.Gap nextGap = gaps.poll();
                int next = nextGap.size;
                if (next > rem) {
                    gaps.add(nextGap);
                    break;
                } else {
                    rem -= next;
                }
            }

            int qsize = gaps.size();
            boolean lastExi = false;
            while (!gaps.isEmpty()) {
                TaskD.Gap g = gaps.poll();
                if (g.last) {
                    lastExi = true;
                    break;
                }
            }

            int res = 1 + qsize * 2;
            if (lastExi) {
                res--;
            }
            out.println(res);

        }

        static class Gap implements Comparable<TaskD.Gap> {
            private final int size;
            private final boolean last;

            public Gap(int size, boolean last) {
                this.size = size;
                this.last = last;
            }

            public int compareTo(TaskD.Gap o) {
                int res = size - o.size;
                if (res != 0) {
                    return res;
                } else {
                    if (last == o.last) {
                        return 0;
                    } else if (last) {
                        return 1;
                    } else {
                        return -1;
                    }
                }
            }

        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public int[] getALineOfInts(int numExpected) {
            int[] res = new int[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Integer.parseInt(st.nextToken());
            return res;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.Collection;
import java.io.IOException;
import java.util.Queue;
import java.io.BufferedReader;
import java.io.InputStreamReader;
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;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            int[] data = in.getALineOfInts(2);
            int n = data[0];
            int k = data[1];
            int[] t = in.getALineOfInts(n);

            Queue<Integer> gaps = new PriorityQueue<>();

            int numNeg = 0;
            for (int i = 0; i < n; i++) {
                if (t[i] < 0) {
                    numNeg++;
                }
            }

            if (numNeg > k) {
                out.println("-1");
                return;
            }

            if (numNeg == 0) {
                out.println(0);
                return;
            }

            int start = 0;
            while (start < n && t[start] >= 0) {
                start++;
            }

            int last = start;
            int j = start + 1;
            for (; j < n; j++) {
                if (t[j] < 0 && t[j - 1] >= 0) {
                    gaps.add(j - last - 1);
                }

                if (t[j] < 0) {
                    last = j;
                }
            }

            int rem = k - numNeg;
            while (rem > 0 && !gaps.isEmpty()) {
                int next = gaps.poll();
                if (next > rem) {
                    gaps.add(next);
                    break;
                } else {
                    rem -= next;
                }
            }

            int qsize = gaps.size();
            int res = 1 + qsize * 2;

            if (n - last > 1) {
                if (n - last - 1 > rem) {
                    res++;
                }
            }

            out.println(res);

        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public int[] getALineOfInts(int numExpected) {
            int[] res = new int[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Integer.parseInt(st.nextToken());
            return res;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Queue;
import java.io.BufferedReader;
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;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            int[] data = in.getALineOfInts(2);
            int n = data[0];
            int k = data[1];
            int[] t = in.getALineOfInts(n);

            Queue<TaskD.Gap> gaps = new PriorityQueue<>();

            int numNeg = 0;
            for (int i = 0; i < n; i++) {
                if (t[i] < 0) {
                    numNeg++;
                }
            }

            if (numNeg > k) {
                out.println("-1");
                return;
            }

            if (numNeg == 0) {
                out.println(0);
                return;
            }

            int start = 0;
            while (start < n && t[start] >= 0) {
                start++;
            }

            int last = start;
            int j = start + 1;
            for (; j < n; j++) {
                if (t[j] < 0 && t[j - 1] >= 0) {
                    gaps.add(new TaskD.Gap(j - last - 1, false));
                }

                if (t[j] < 0) {
                    last = j;
                }
            }

            int rem = k - numNeg;
            while (rem > 0 && !gaps.isEmpty()) {
                TaskD.Gap nextGap = gaps.poll();
                int next = nextGap.size;
                if (next > rem) {
                    gaps.add(nextGap);
                    break;
                } else {
                    rem -= next;
                }
            }

            int qsize = gaps.size();
            int res = 1 + qsize * 2;

            if (n - last > 1) {
                if (n - last - 1 > rem) {
                    res++;
                }
            }

            out.println(res);

        }

        static class Gap implements Comparable<TaskD.Gap> {
            private final int size;
            private final boolean last;

            public Gap(int size, boolean last) {
                this.size = size;
                this.last = last;
            }

            public int compareTo(TaskD.Gap o) {
                int res = size - o.size;
                if (res != 0) {
                    return res;
                } else {
                    if (last == o.last) {
                        return 0;
                    } else if (last) {
                        return 1;
                    } else {
                        return -1;
                    }
                }
            }

        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public int[] getALineOfInts(int numExpected) {
            int[] res = new int[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Integer.parseInt(st.nextToken());
            return res;
        }

    }
}


import java.util.*;
import java.io.*;

public class CF747D {
	public static void main(String[] args) throws IOException
	{
		BufferedReader fin = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(fin.readLine());
		int N = Integer.parseInt(st.nextToken());
		int K = Integer.parseInt(st.nextToken());
		int[] days = new int[N];

		st = new StringTokenizer(fin.readLine());
		for(int i = 0; i < N; i++)
		{
			days[i] = Integer.parseInt(st.nextToken());
		}

		int count = 0;
		for (int i = 0; i < N; i++) {
			if (days[i] < 0) {
				count++;
			}
		}
		if (count > K) {
			System.out.println(-1);
		}
		else
		{
			int left = K - count;
			int current = 0;
			int change[] = new int[N];
			int j = 0;
			boolean start  = false;

			for (int i = 0; i < N; i++)
			{
				if (days[i] < 0) {
					change[j] = current;
					current = 0;
					j++;
					start = true;
				}
				else if (start)
				{
					current++;
				}
			}
			Arrays.sort(change);

			for (int i = 0; i < N; i++)
			{
				if (change[i] <= left)
				{
					left -= change[i];
					change[i] = 0;
				}
				else
				{
					break;
				}
			}

			int tot = 0;
			for (int i = 0; i < N; i++)
			{
				if (change[i] > 0)
				{
					tot += 2;
				}
			}

			if (start)
			{
				tot++;
			}

			if (current > left)
			{
				tot++;
			}

			System.out.println(tot);
		}
	}
}


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

/**
 * Created by Firеfly on 12/18/2016.
 */
public class code {
    public static void main(String[] args) throws IOException {
        Woorker worker = new Woorker();
    }
}
class Woorker {
    Woorker() throws IOException {
        FastScannerqq fs = new FastScannerqq(new InputStreamReader(System.in));
        int n = fs.nextInt();
        int k = fs.nextInt();
        int[] mas = new int[n];
        for (int i = 0; i<n; i++)
            mas[i] = fs.nextInt();
        int count = 0;
        int k1 =0;
        if (mas[0] <0) {
            k1++;
            count++;
        }
        boolean flag = true;
        ArrayList<Integer> list = new ArrayList<>();
        int met = 0;
        for (int i = 1; i<n; i++)
        {
            if (mas[i] <0)
                k1++;
            if (positive(mas[i])!=positive(mas[i-1]))
            { count++;
              if (!positive(mas[i-1]) && positive(mas[i]))
              {list.add(met, i-1); flag = false; }
              else if (list.size()!=0){list.set(met, i-list.get(met));
              met++;
              flag = true;}
        }}
        if (flag == false)
            list.set(list.size()-1, n-list.get(list.size()-1));
        if (k1>k)
            System.out.println(-1);
        else {
            int diff = k-k1;
            int prob = -1;
            if (list.size()>0)
            prob = list.get(list.size()-1);
            list.sort(Integer::compareTo);
            int q = 0;
            while (q<list.size() && (diff-list.get(q)+1)>=0) {
                diff-=list.get(q)-1;
                if (flag == false && list.get(q)==prob && ((q == list.size()-1) || list.get(q+1)!=prob)) {
                    count--;
                    flag = true;
                }
                else
                count-=2;
                q++;
            }
            System.out.println(count);
        }

    }
    boolean positive(int n){
        if (n>=0)
            return true;
        else return false;
    }
}

class FastScannerqq {
    BufferedReader br;
    StringTokenizer stok;

    FastScannerqq(InputStreamReader fr) {
        br = new BufferedReader(fr);
    }

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) br.read();
    }

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


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

/**
 * Created by Firеfly on 12/18/2016.
 */
public class code {
    public static void main(String[] args) throws IOException {
        Woorker worker = new Woorker();
    }
}
class Woorker {
    Woorker() throws IOException {
        FastScannerqq fs = new FastScannerqq(new InputStreamReader(System.in));
        int n = fs.nextInt();
        int k = fs.nextInt();
        int[] mas = new int[n];
        for (int i = 0; i<n; i++)
            mas[i] = fs.nextInt();
        int count = 0;
        int k1 =0;
        if (mas[0] <0) {
            k1++;
            count++;
        }
        boolean flag = true;
        ArrayList<Integer> list = new ArrayList<>();
        int met = 0;
        for (int i = 1; i<n; i++)
        {
            if (mas[i] <0)
                k1++;
            if (positive(mas[i])!=positive(mas[i-1]))
            { count++;
                if (!positive(mas[i-1]) && positive(mas[i]))
                {list.add(met, i-1); flag = false; }
                else if (list.size()!=0){list.set(met, i-list.get(met));
                    met++;
                    flag = true;}
            }}
        int wat = 0;
            if (flag == false)
            wat = n-list.remove(list.size()-1);
        if (k1>k)
            System.out.println(-1);
        else {
            int diff = k-k1;
            list.sort(Integer::compareTo);
            int q = 0;
            while (q<list.size() && (diff-list.get(q)+1)>=0) {
                diff-=list.get(q)-1;
                count-=2;
                q++;
            }
            if (flag == false && diff-wat+1>=0)
                count--;

            System.out.println(count);
        }

    }
    boolean positive(int n){
        if (n>=0)
            return true;
        else return false;
    }
}

class FastScannerqq {
    BufferedReader br;
    StringTokenizer stok;

    FastScannerqq(InputStreamReader fr) {
        br = new BufferedReader(fr);
    }

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) br.read();
    }

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


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

/**
 * Created by Firеfly on 12/18/2016.
 */
public class code {
    public static void main(String[] args) throws IOException {
        Woorker worker = new Woorker();
    }
}
class Woorker {
    Woorker() throws IOException {
        FastScannerqq fs = new FastScannerqq(new InputStreamReader(System.in));
        int n = fs.nextInt();
        int k = fs.nextInt();
        int[] mas = new int[n];
        for (int i = 0; i<n; i++)
            mas[i] = fs.nextInt();
        int count = 0;
        int k1 =0;
        if (mas[0] <0) {
            k1++;
            count++;
        }
        boolean flag = true;
        ArrayList<Integer> list = new ArrayList<>();
        int met = 0;
        for (int i = 1; i<n; i++)
        {
            if (mas[i] <0)
                k1++;
            if (positive(mas[i])!=positive(mas[i-1]))
            { count++;
              if (!positive(mas[i-1]) && positive(mas[i]))
              {list.add(met, i-1); flag = false; }
              else if (list.size()!=0){list.set(met, i-list.get(met));
              met++;
              flag = true;}
        }}
        if (flag == false)
            list.set(list.size()-1, n-list.get(list.size()-1));
        if (k1>k)
            System.out.println(-1);
        else {
            int diff = k-k1;
            int prob = -1;
            if (list.size()>0)
            prob = list.get(list.size()-1);
            list.sort(Integer::compareTo);
            int q = 0;
            while (q<list.size() && (diff-list.get(q)+1)>=0) {
                diff-=list.get(q);
                if (flag == false && list.get(q)==prob && ((q == list.size()-1) || list.get(q+1)!=prob)) {
                    count--;
                    flag = true;
                }
                else
                count-=2;
                q++;
            }
            System.out.println(count);
        }

    }
    boolean positive(int n){
        if (n>=0)
            return true;
        else return false;
    }
}

class FastScannerqq {
    BufferedReader br;
    StringTokenizer stok;

    FastScannerqq(InputStreamReader fr) {
        br = new BufferedReader(fr);
    }

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) br.read();
    }

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


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

/**
 * Created by Firеfly on 12/18/2016.
 */
public class code {
    public static void main(String[] args) throws IOException {
        Woorker worker = new Woorker();
    }
}
class Woorker {
    Woorker() throws IOException {
        FastScannerqq fs = new FastScannerqq(new InputStreamReader(System.in));
        int n = fs.nextInt();
        int k = fs.nextInt();
        int[] mas = new int[n];
        for (int i = 0; i<n; i++)
            mas[i] = fs.nextInt();
        int count = 0;
        int k1 =0;
        if (mas[0] <0) {
            k1++;
            count++;
        }
        boolean flag = true;
        ArrayList<Integer> list = new ArrayList<>();
        int met = 0;
        for (int i = 1; i<n; i++)
        {
            if (mas[i] <0)
                k1++;
            if (positive(mas[i])!=positive(mas[i-1]))
            { count++;
              if (!positive(mas[i-1]) && positive(mas[i]))
              {list.add(met, i-1); flag = false; }
              else if (list.size()!=0){list.set(met, i-list.get(met));
              met++;
              flag = true;}
        }}
        if (flag == false)
            list.set(list.size()-1, n-list.get(list.size()-1));
        if (k1>k)
            System.out.println(-1);
        else {
            int diff = k-k1;
            int prob = list.get(list.size()-1);
            list.sort(Integer::compareTo);
            int q = 0;
            while (q<list.size() && (diff-list.get(q)+1)>=0) {
                diff-=list.get(q);
                if (flag == false && list.get(q)==prob && (q == list.size()-1) || list.get(q+1)!=prob) {
                    count--;
                    flag = true;
                }
                else
                count-=2;
                q++;
            }
            System.out.println(count);
        }

    }
    boolean positive(int n){
        if (n>=0)
            return true;
        else return false;
    }
}

class FastScannerqq {
    BufferedReader br;
    StringTokenizer stok;

    FastScannerqq(InputStreamReader fr) {
        br = new BufferedReader(fr);
    }

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) br.read();
    }

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


import java.util.PriorityQueue;
import java.util.Scanner;

public class P747D
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++)
			arr[i] = scan.nextInt();
		boolean start = false; //There has been a winter
		int either = 0;
		PriorityQueue<Integer> pq = new PriorityQueue<>();
		for (int i = 0; i < arr.length; i++)
		{
			if (!start)
			{
				if (arr[i] < 0)
				{
					start = true;
					k--;
				}
				continue;
			}

			if (arr[i] >= 0)
				either++;
			else
			{
				k--;
				if (either > 0)
					pq.add(either);
				either = 0;
			}
		}
		if (!start)
		{
			System.out.println(0);
			return;
		}
		if (k < 0)
		{
			System.out.println(-1);
			return;
		}
		while (!pq.isEmpty())
		{
			int low = pq.poll();
			if (k < low)
			{
				pq.add(low);
				break;
			}
			else
				 k -= low;
		}
		if (either > 0 && k >= either)
		{
			either = 0;
			k -= either;
		}
		System.out.println(1 + 2*pq.size() + (either > 0 ? 1 : 0));
	}
}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;
public class ProblemD {
	public static void main(String[] str)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] t = new int[n];
		for(int i=0; i<n; i++)
		{
			t[i] = sc.nextInt();
		}
		sc.close();
		int from = 0;
		int to = n-1;
		while (from < n && t[from]>=0) from++;
		while (to>=0 && t[to]>=0) to--;

		t = Arrays.copyOfRange(t, from,to);

		int[] sum = new int[n];
		int csum = 0;
		boolean pre = false;
		for(int i=0; i<t.length; i++)
		{
			if(!pre && t[i]>=0)
			{
				sum[csum] = 1;
				csum++;
			}
			else if(pre && t[i]>=0)
			{
				sum[csum-1]++;
			}
			pre = t[i] >= 0;
		}
		sum = Arrays.copyOf(sum, csum);
		Arrays.sort(sum);

		int nchange = 1;
		int kused = n - from;

		if(n - from <= k)
		{
			if (n - from == 0)
				System.out.println(0);
			else
				System.out.println(1);
			return;
		}
		if(n-(n-to-1)<=k)
		{
			System.out.println(2);
			return;
		}

		if(n - (n-to-1) - from <= k)
		{
			System.out.println(2);
			return;
		}

		for(int i=sum.length-1; i>=0; i--)
		{
			kused -= sum[i];
			nchange+=2;

			if(kused <= k)
			{
				System.out.println(nchange);
				return;
			}

			if(kused - (n-to-1) <= k)
			{
				System.out.println(nchange+1);
				return;
			}

			if(kused - from - (n-to-1) <= k)
			{
				System.out.println(nchange+2);
				return;
			}
		}
		System.out.println(-1);

	}
}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;
public class ProblemD {
	public static void main(String[] str)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] t = new int[n];
		for(int i=0; i<n; i++)
		{
			t[i] = sc.nextInt();
		}
		sc.close();
		int from = 0;
		int to = n-1;
		while (from < n && t[from]>=0) from++;
		while (to>=0 && t[to]>=0) to--;
		if(from>to)
		{
			System.out.println(0);
			return;
		}
		t = Arrays.copyOfRange(t, from,to);

		int[] sum = new int[n];
		int csum = 0;
		boolean pre = false;
		for(int i=0; i<t.length; i++)
		{
			if(!pre && t[i]>=0)
			{
				sum[csum] = 1;
				csum++;
			}
			else if(pre && t[i]>=0)
			{
				sum[csum-1]++;
			}
			pre = t[i] >= 0;
		}
		sum = Arrays.copyOf(sum, csum);
		Arrays.sort(sum);

		int nchange = 1;
		int kused = n - from;

		if(n - from <= k)
		{
			if (n - from == 0)
				System.out.println(0);
			else
				System.out.println(1);
			return;
		}

		if(n - (n-to-1) - from <= k)
		{
			System.out.println(2);
			return;
		}

		for(int i=sum.length-1; i>=0; i--)
		{
			kused -= sum[i];
			nchange+=2;

			if(kused <= k)
			{
				System.out.println(nchange);
				return;
			}

			if(kused - (n-to-1) <= k)
			{
				System.out.println(nchange+1);
				return;
			}
		}
		System.out.println(-1);

	}
}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;
public class ProblemD {
	public static void main(String[] str)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] t = new int[n];
		for(int i=0; i<n; i++)
		{
			t[i] = sc.nextInt();
		}
		sc.close();
		int from = 0;
		int to = n-1;
		while (from < n && t[from]>=0) from++;
		while (to>=0 && t[to]>=0) to--;

		t = Arrays.copyOfRange(t, from,to);

		int[] sum = new int[n];
		int csum = 0;
		boolean pre = false;
		for(int i=0; i<t.length; i++)
		{
			if(!pre && t[i]>=0)
			{
				sum[csum] = 1;
				csum++;
			}
			else if(pre && t[i]>=0)
			{
				sum[csum-1]++;
			}
			pre = t[i] >= 0;
		}
		sum = Arrays.copyOf(sum, csum);
		Arrays.sort(sum);

		int nchange = 1;
		int kused = n - from;

		if(n - from <= k)
		{
			if (n - from == 0)
				System.out.println(0);
			else
				System.out.println(1);
			return;
		}

		if(n - (n-to-1) - from <= k)
		{
			System.out.println(2);
			return;
		}

		for(int i=sum.length-1; i>=0; i--)
		{
			kused -= sum[i];
			nchange+=2;

			if(kused <= k)
			{
				System.out.println(nchange);
				return;
			}

			if(kused - (n-to-1) <= k)
			{
				System.out.println(nchange+1);
				return;
			}
		}
		System.out.println(-1);

	}
}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;
public class ProblemD {
	public static void main(String[] str)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] t = new int[n];
		for(int i=0; i<n; i++)
		{
			t[i] = sc.nextInt();
		}
		sc.close();
		int from = 0;
		int to = n-1;
		while (from < n && t[from]>=0) from++;
		while (to>=0 && t[to]>=0) to--;

		t = Arrays.copyOfRange(t, from,to);

		int[] sum = new int[n];
		int csum = 0;
		boolean pre = false;
		for(int i=0; i<t.length; i++)
		{
			if(!pre && t[i]>=0)
			{
				sum[csum] = 1;
				csum++;
			}
			else if(pre && t[i]>=0)
			{
				sum[csum-1]++;
			}
			pre = t[i] >= 0;
		}
		sum = Arrays.copyOf(sum, csum);
		Arrays.sort(sum);

		int nchange = 1;
		int kused = n;

		if(n - from <= k)
		{
			if (n - from == 0)
				System.out.println(0);
			else
				System.out.println(1);
			return;
		}
		if(n-(n-to-1)<=k)
		{
			System.out.println(2);
			return;
		}

		if(n - (n-to-1) - from <= k)
		{
			System.out.println(2);
			return;
		}

		for(int i=sum.length-1; i>=0; i--)
		{
			kused -= sum[i];
			nchange+=2;

			if(kused <= k)
			{
				System.out.println(nchange);
				return;
			}

			if(kused - from <= k)
			{
				System.out.println(nchange+1);
				return;
			}

			if(kused - (n-to-1) <= k)
			{
				System.out.println(nchange+1);
				return;
			}

			if(kused - from - (n-to-1) <= k)
			{
				System.out.println(nchange+2);
				return;
			}
		}
		System.out.println(-1);

	}
}


import java.io.*;
import java.util.*;

public class icpc
{
    public static void main(String[] args) throws IOException
    {
        Reader in = new Reader();
        //BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int n = in.nextInt();
        int k = in.nextInt();
        int[] A = new int[n];
        int count = 0;
        for (int i=0;i<n;i++)
        {
            int x = in.nextInt();
            if (x >= 0)
                A[i] = 1;
            else
            {
                A[i] = 0;
                count ++;
            }
        }

        int first = -1;
        for (int i=0;i<n;i++)
        {
            if (A[i] == 0)
            {
                first = i;
                break;
            }
        }
        ArrayList<Integer> C = new ArrayList<>();
        for (int i=0;i<n;i++)
        {
            if (A[i] == 0)
                C.add(i);
        }

        if (count > k)
            System.out.println(-1);
        else if (first == -1)
            System.out.println(0);
        else
        {
            int ans = 0;
            n = C.size();
            for (int i=0;i<n;i++)
            {
                int j = i + 1;
                while (j < n && C.get(j) == C.get(j - 1) + 1)
                    j++;
                if (j == n && C.get(j - 1) == A.length - 1)
                    ans ++;
                else
                    ans += 2;
                i = j - 1;
            }
            n = A.length;
            int lenLast = 0;
            ArrayList<Integer> B = new ArrayList<>();
            for (int i=first;i<n;i++)
            {
                int j = i + 1;
                while (j < n && A[j] == 1)
                    j ++;
                if (j - i - 1 > 0)
                {
                    if (j == n)
                        lenLast = j - i - 1;
                    else
                       B.add(j - i - 1);
                }
                i = j - 1;
            }
            int h1 = getAns(B, count, k);
            int h2 = h1;
            if (lenLast > 0 && count + lenLast <= k)
            {
                h2 = getAns(B, count + lenLast, k) + 1;
            }
            ans -= Math.max(h1, h2);
            System.out.println(ans);

        }

    }
    public static int getAns(ArrayList<Integer> B, int count, int k)
    {
        Collections.sort(B);
        int sum = count;
        int ret = 0;
        for (int i=0;i<B.size();i++)
        {
            if (sum + B.get(i) > k)
                break;
            else
            {
                sum += B.get(i);
                ret += 2;
            }
        }
        return ret;
    }
}
class DSU
{
    int[] parent;
    int[] size;
    //Pass number of total nodes as parameter to the constructor
    DSU(int n)
    {
        this.parent = new int[n];
        this.size = new int[n];
        Arrays.fill(parent, -1);
    }

    public void makeSet(int v)
    {
        parent[v] = v;
        size[v] = 1;
    }

    public int findSet(int v)
    {
        if (v == parent[v]) return v;
        return parent[v] = findSet(parent[v]);
    }

    public void unionSets(int a, int b)
    {
        a = findSet(a);
        b = findSet(b);
        if (a != b)
        {
            if (size[a] < size[b])
            {
                int temp = a;
                a = b;
                b = temp;
            }
            parent[b] = a;
            size[a] += size[b];
        }
    }
}
class FastFourierTransform
{
    private void fft(double[] a, double[] b, boolean invert)
    {
        int count = a.length;
        for (int i = 1, j = 0; i < count; i++)
        {
            int bit = count >> 1;
            for (; j >= bit; bit >>= 1)
                j -= bit;
            j += bit;
            if (i < j)
            {
                double temp = a[i];
                a[i] = a[j];
                a[j] = temp;
                temp = b[i];
                b[i] = b[j];
                b[j] = temp;
            }
        }
        for (int len = 2; len <= count; len <<= 1)
        {
            int halfLen = len >> 1;
            double angle = 2 * Math.PI / len;
            if (invert)
                angle = -angle;
            double wLenA = Math.cos(angle);
            double wLenB = Math.sin(angle);
            for (int i = 0; i < count; i += len)
            {
                double wA = 1;
                double wB = 0;
                for (int j = 0; j < halfLen; j++)
                {
                    double uA = a[i + j];
                    double uB = b[i + j];
                    double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
                    double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
                    a[i + j] = uA + vA;
                    b[i + j] = uB + vB;
                    a[i + j + halfLen] = uA - vA;
                    b[i + j + halfLen] = uB - vB;
                    double nextWA = wA * wLenA - wB * wLenB;
                    wB = wA * wLenB + wB * wLenA;
                    wA = nextWA;
                }
            }
        }
        if (invert)
        {
            for (int i = 0; i < count; i++)
            {
                a[i] /= count;
                b[i] /= count;
            }
        }
    }

    public long[] multiply(long[] a, long[] b)
    {
        int resultSize = Integer.highestOneBit(Math.max(a.length, b.length) - 1) << 2;
        resultSize = Math.max(resultSize, 1);
        double[] aReal = new double[resultSize];
        double[] aImaginary = new double[resultSize];
        double[] bReal = new double[resultSize];
        double[] bImaginary = new double[resultSize];
        for (int i = 0; i < a.length; i++)
            aReal[i] = a[i];
        for (int i = 0; i < b.length; i++)
            bReal[i] = b[i];
        fft(aReal, aImaginary, false);
        fft(bReal, bImaginary, false);
        for (int i = 0; i < resultSize; i++)
        {
            double real = aReal[i] * bReal[i] - aImaginary[i] * bImaginary[i];
            aImaginary[i] = aImaginary[i] * bReal[i] + bImaginary[i] * aReal[i];
            aReal[i] = real;
        }
        fft(aReal, aImaginary, true);
        long[] result = new long[resultSize];
        for (int i = 0; i < resultSize; i++)
            result[i] = Math.round(aReal[i]);
        return result;
    }
}
class NumberTheory
{
    public boolean isPrime(long n)
    {
        if(n < 2)
            return false;
        for(long x = 2;x * x <= n;x++)
        {
            if(n % x == 0)
                return false;
        }
        return true;
    }
    public ArrayList<Long> primeFactorisation(long n)
    {
        ArrayList<Long> f = new ArrayList<>();
        for(long x=2;x * x <= n;x++)
        {
            while(n % x == 0)
            {
                f.add(x);
                n /= x;
            }
        }
        if(n > 1)
            f.add(n);
        return f;
    }
    public int[] sieveOfEratosthenes(int n)
    {
        //Returns an array with the smallest prime factor for each number and primes marked as 0
        int[] sieve = new int[n + 1];
        for(int x=2;x * x <= n;x++)
        {
            if(sieve[x] != 0)
                continue;
            for(int u=x*x;u<=n;u+=x)
            {
                if(sieve[u] == 0)
                {
                    sieve[u] = x;
                }
            }
        }
        return sieve;
    }
    public long gcd(long a, long b)
    {
        if(b == 0)
            return a;
        return gcd(b, a % b);
    }
    public long phi(long n)
    {
        double result = n;

        for(long p=2;p*p<=n;p++)
        {
            if(n % p == 0)
            {
                while (n % p == 0)
                    n /= p;
                result *= (1.0 - (1.0 / (double)p));
            }
        }
        if(n > 1)
            result *= (1.0 - (1.0 / (double)n));
        return (long)result;
    }
    public Name extendedEuclid(long a, long b)
    {
        if(b == 0)
            return new Name(a, 1, 0);
        Name n1 = extendedEuclid(b, a % b);
        Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);
        return n2;
    }
    public long modularExponentiation(long a, long b, long n)
    {
        long d = 1L;
        String bString = Long.toBinaryString(b);
        for(int i=0;i<bString.length();i++)
        {
            d = (d * d) % n;
            if(bString.charAt(i) == '1')
                d = (d * a) % n;
        }
        return d;
    }
}
class Name
{
    long d;
    long x;
    long y;

    public Name(long d, long x, long y)
    {
        this.d = d;
        this.x = x;
        this.y = y;
    }
}
class SuffixArray
{
    int ALPHABET_SZ = 256, N;
    int[] T, lcp, sa, sa2, rank, tmp, c;

    public SuffixArray(String str)
    {
        this(toIntArray(str));
    }

    private static int[] toIntArray(String s)
    {
        int[] text = new int[s.length()];
        for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);
        return text;
    }

    public SuffixArray(int[] text)
    {
        T = text;
        N = text.length;
        sa = new int[N];
        sa2 = new int[N];
        rank = new int[N];
        c = new int[Math.max(ALPHABET_SZ, N)];
        construct();
        kasai();
    }

    private void construct()
    {
        int i, p, r;
        for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;
        for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
        for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;
        for (p = 1; p < N; p <<= 1)
        {
            for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;
            for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;
            Arrays.fill(c, 0, ALPHABET_SZ, 0);
            for (i = 0; i < N; ++i) c[rank[i]]++;
            for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
            for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];
            for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)
            {
                if (!(rank[sa[i - 1]] == rank[sa[i]]
                        && sa[i - 1] + p < N
                        && sa[i] + p < N
                        && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;
                sa2[sa[i]] = r;
            }
            tmp = rank;
            rank = sa2;
            sa2 = tmp;
            if (r == N - 1) break;
            ALPHABET_SZ = r + 1;
        }
    }

    private void kasai()
    {
        lcp = new int[N];
        int[] inv = new int[N];
        for (int i = 0; i < N; i++) inv[sa[i]] = i;
        for (int i = 0, len = 0; i < N; i++)
        {
            if (inv[i] > 0)
            {
                int k = sa[inv[i] - 1];
                while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;
                lcp[inv[i] - 1] = len;
                if (len > 0) len--;
            }
        }
    }
}
class ZAlgorithm
{
    public int[] calculateZ(char input[])
    {
        int Z[] = new int[input.length];
        int left = 0;
        int right = 0;
        for(int k = 1; k < input.length; k++) {
            if(k > right) {
                left = right = k;
                while(right < input.length && input[right] == input[right - left]) {
                    right++;
                }
                Z[k] = right - left;
                right--;
            } else {
                //we are operating inside box
                int k1 = k - left;
                //if value does not stretches till right bound then just copy it.
                if(Z[k1] < right - k + 1) {
                    Z[k] = Z[k1];
                } else { //otherwise try to see if there are more matches.
                    left = k;
                    while(right < input.length && input[right] == input[right - left]) {
                        right++;
                    }
                    Z[k] = right - left;
                    right--;
                }
            }
        }
        return Z;
    }
    public ArrayList<Integer> matchPattern(char text[], char pattern[])
    {
        char newString[] = new char[text.length + pattern.length + 1];
        int i = 0;
        for(char ch : pattern) {
            newString[i] = ch;
            i++;
        }
        newString[i] = '$';
        i++;
        for(char ch : text) {
            newString[i] = ch;
            i++;
        }
        ArrayList<Integer> result = new ArrayList<>();
        int Z[] = calculateZ(newString);

        for(i = 0; i < Z.length ; i++) {
            if(Z[i] == pattern.length) {
                result.add(i - pattern.length - 1);
            }
        }
        return result;
    }
}
class KMPAlgorithm
{
    public int[] computeTemporalArray(char[] pattern)
    {
        int[] lps = new int[pattern.length];

        int index = 0;
        for(int i=1;i<pattern.length;)
        {
            if(pattern[i] == pattern[index])
            {
                lps[i] = index + 1;
                index++;
                i++;
            }
            else
            {
                if(index != 0)
                {
                    index = lps[index - 1];
                }
                else
                {
                    lps[i] = 0;
                    i++;
                }
            }
        }
        return lps;
    }

    public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)
    {
        int[] lps = computeTemporalArray(pattern);

        int j = 0;
        int i = 0;
        int n = text.length;
        int m = pattern.length;
        ArrayList<Integer> indices = new ArrayList<>();
        while(i < n)
        {
            if(pattern[j] == text[i])
            {
                i++;
                j++;
            }
            if(j == m)
            {
                indices.add(i - j);
                j = lps[j - 1];
            }
            else if(i < n && pattern[j] != text[i])
            {
                if(j != 0)
                    j = lps[j - 1];
                else
                    i = i + 1;
            }
        }
        return indices;
    }
}
class Hashing
{
    public long[] computePowers(long p, int n, long m)
    {
        long[] powers = new long[n];
        powers[0] = 1;
        for(int i=1;i<n;i++)
        {
            powers[i] = (powers[i - 1] * p) % m;
        }
        return powers;
    }
    public long computeHash(String s)
    {
        long p = 31;
        long m = 1_000_000_009;
        long hashValue = 0L;
        long[] powers = computePowers(p, s.length(), m);
        for(int i=0;i<s.length();i++)
        {
            char ch = s.charAt(i);
            hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;
        }
        return hashValue;
    }
}
class BasicFunctions
{
    public int maxOfIntArray(int[] A)
    {
        int max = Integer.MIN_VALUE;
        for (int i=0;i<A.length;i++)    max = Math.max(max, A[i]);
        return max;
    }
    public long maxOfLongArray(long[] A)
    {
        long max = Long.MIN_VALUE;
        for (int i=0;i<A.length;i++)    max = Math.max(max, A[i]);
        return max;
    }
    public int minOfIntArray(int[] A)
    {
        int min = Integer.MAX_VALUE;
        for (int i=0;i<A.length;i++)    min = Math.min(min, A[i]);
        return min;
    }
    public long minOfLongArray(long[] A)
    {
        long min = Long.MAX_VALUE;
        for (int i=0;i<A.length;i++)    min = Math.min(min, A[i]);
        return min;
    }

}
class MergeSortInt
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

}
class MergeSortLong
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(long arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(long arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
}
class Node
{

    int x;
    int y;

    public Node(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object ob)
    {
        if(ob == null)
            return false;
        if(!(ob instanceof Node))
            return false;
        if(ob == this)
            return true;
        Node obj = (Node)ob;
        if(this.x == obj.x && this.y == obj.y)
            return true;
        return false;
    }

    @Override
    public int hashCode()
    {
        return (int)this.x;
    }
}
class Reader
{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader()
    {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException
    {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException
    {
        byte[] buf = new byte[64]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1)
        {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException
    {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do
        {
            ret = ret * 10 + c - '0';
        }  while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws IOException
    {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');
        if (neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException
    {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.')
        {
            while ((c = read()) >= '0' && c <= '9')
            {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException
    {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException
    {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException
    {
        if (din == null)
            return;
        din.close();
    }
}
class SegmentTree
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }
    public int[] createSegmentTree(int[] input)
    {
        int np2 = nextPowerOfTwo(input.length);
        int[] segmentTree = new int[np2 * 2 - 1];

        for(int i=0;i<segmentTree.length;i++)
            segmentTree[i] = Integer.MIN_VALUE;

        constructSegmentTree(segmentTree,input,0,input.length-1,0);
        return segmentTree;

    }
    private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/ 2;
        constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);
        constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);
        segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);
    }
    public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)
    {
        return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);
    }
    private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)
    {
        if(qlow <= low && qhigh >= high){
            return segmentTree[pos];
        }
        if(qlow > high || qhigh < low){
            return Integer.MIN_VALUE;
        }
        int mid = (low+high)/2;
        return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),
                rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));
    }
}
class Trie
{

    private class TrieNode
    {
        Map<Character, TrieNode> children;
        boolean endOfWord;
        public TrieNode()
        {
            children = new HashMap<>();
            endOfWord = false;
        }
    }

    private final TrieNode root;
    public Trie()
    {
        root = new TrieNode();
    }

    public void insert(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                node = new TrieNode();
                current.children.put(ch, node);
            }
            current = node;
        }
        current.endOfWord = true;
    }

    public boolean search(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                return false;
            }
            current = node;
        }
        return current.endOfWord;
    }

    public void delete(String word)
    {
        delete(root, word, 0);
    }

    private boolean delete(TrieNode current, String word, int index)
    {
        if (index == word.length())
        {
            if (!current.endOfWord)
            {
                return false;
            }
            current.endOfWord = false;
            return current.children.size() == 0;
        }
        char ch = word.charAt(index);
        TrieNode node = current.children.get(ch);
        if (node == null)
        {
            return false;
        }
        boolean shouldDeleteCurrentNode = delete(node, word, index + 1);

        if (shouldDeleteCurrentNode)
        {
            current.children.remove(ch);
            return current.children.size() == 0;
        }
        return false;
    }
}
class SegmentTreeLazy
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }

    public int[] createSegmentTree(int input[])
    {
        int nextPowOfTwo = nextPowerOfTwo(input.length);
        int segmentTree[] = new int[nextPowOfTwo*2 -1];

        for(int i=0; i < segmentTree.length; i++){
            segmentTree[i] = Integer.MAX_VALUE;
        }
        constructMinSegmentTree(segmentTree, input, 0, input.length - 1, 0);
        return segmentTree;
    }

    private void constructMinSegmentTree(int segmentTree[], int input[], int low, int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/2;
        constructMinSegmentTree(segmentTree, input, low, mid, 2 * pos + 1);
        constructMinSegmentTree(segmentTree, input, mid + 1, high, 2 * pos + 2);
        segmentTree[pos] = Math.min(segmentTree[2*pos+1], segmentTree[2*pos+2]);
    }

    public void updateSegmentTreeRangeLazy(int input[], int segmentTree[], int lazy[], int startRange, int endRange, int delta)
    {
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, 0, input.length - 1, 0);
    }

    private void updateSegmentTreeRangeLazy(int segmentTree[], int lazy[], int startRange, int endRange, int delta, int low, int high, int pos)
    {
        if(low > high)
        {
            return;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(startRange > high || endRange < low)
        {
            return;
        }

        if(startRange <= low && endRange >= high)
        {
            segmentTree[pos] += delta;
            if(low != high) {
                lazy[2*pos + 1] += delta;
                lazy[2*pos + 2] += delta;
            }
            lazy[pos] = 0;
        }

        int mid = (low + high)/2;
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, low, mid, 2*pos+1);
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, mid+1, high, 2*pos+2);
        segmentTree[pos] = Math.min(segmentTree[2*pos + 1], segmentTree[2*pos + 2]);
    }

    public int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int len)
    {
        return rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, 0, len - 1, 0);
    }

    private int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int low, int high, int pos)
    {
        if(low > high)
        {
            return Integer.MAX_VALUE;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(qlow > high || qhigh < low)
        {
            return Integer.MAX_VALUE;
        }

        if(qlow <= low && qhigh >= high)
        {
            return segmentTree[pos];
        }

        int mid = (low+high)/2;
        return Math.min(rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, low, mid, 2 * pos + 1), rangeMinimumQueryLazy(segmentTree, lazy,  qlow, qhigh, mid + 1, high, 2 * pos + 2));
    }
}
class BIT1
{
    int size;
    int[] table;
    public BIT1(int size)
    {
        table = new int[size];
        this.size = size;
    }

    void update(int i, long delta)
    {
        while (i > 0)
        {
            table[i] += delta;
            i -= Integer.lowestOneBit(i);
        }
    }

    int sum(int i)
    {
        int sum = 0;
        while (i < size)
        {
            sum += table[i];
            i += Integer.lowestOneBit(i);
        }
        return sum;
    }
}
class BIT2
{
    int size;
    int[] table;
    public BIT2(int size)
    {
        table = new int[size];
        this.size = size;
    }

    void update(int i, long delta)
    {
        while (i < size)
        {
            table[i] += delta;
            i += Integer.lowestOneBit(i);
        }
    }

    int sum(int i)
    {
        int sum = 0;
        while (i > 0)
        {
            sum += table[i];
            i -= Integer.lowestOneBit(i);
        }
        return sum;
    }
}