The busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.

If x is the number of passengers in a bus just before the current bus stop and y is the number of passengers in the bus just after current bus stop, the system records the number y-x. So the system records show how number of passengers changed.

The test run was made for single bus and n bus stops. Thus, the system recorded the sequence of integers a_1, a_2, ..., a_n (exactly one number for each bus stop), where a_i is the record for the bus stop i. The bus stops are numbered from 1 to n in chronological order.

Determine the number of possible ways how many people could be in the bus before the first bus stop, if the bus has a capacity equals to w (that is, at any time in the bus there should be from 0 to w passengers inclusive).

Input

The first line contains two integers n and w (1 ≤ n ≤ 1 000, 1 ≤ w ≤ 10^{9}) — the number of bus stops and the capacity of the bus.

The second line contains a sequence a_1, a_2, ..., a_n (-10^{6} ≤ a_i ≤ 10^{6}), where a_i equals to the number, which has been recorded by the video system after the i-th bus stop.

Output

Print the number of possible ways how many people could be in the bus before the first bus stop, if the bus has a capacity equals to w. If the situation is contradictory (i.e. for any initial number of passengers there will be a contradiction), print 0.

Examples

Input

3 5
2 1 -3


Output

3


Input

2 4
-1 1


Output

4


Input

4 10
2 4 1 2


Output

2

Note

In the first example initially in the bus could be 0, 1 or 2 passengers.

In the second example initially in the bus could be 1, 2, 3 or 4 passengers.

In the third example initially in the bus could be 0 or 1 passenger.
		import java.util.*;
		import java.util.*;
		import javax.swing.plaf.synth.SynthSpinnerUI;
		import javax.swing.plaf.synth.SynthStyle;
		import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
		import java.util.StringTokenizer;
		import java.io.BufferedReader;
		import java.io.IOException;
		import java.io.InputStreamReader;
		
		public class mohamedy23
				{
			//to order according region and score
		public static	class Pair implements Comparable<Pair> {
		  		int reg, score;String s;
		   
		  		public Pair(int reg, int score,String s) {
		  			this.reg = reg;
		  			this.score = score;
		  			this.s=s;
		  		}
		   
		  		public int compareTo(Pair A) {
		  			if(reg==A.reg)return A.score-score;
		  			return reg-A.reg;
		  		}
		  		public String toString() {
		  			return reg+" "+score+" "+s;
		  		}
		   
		  		
		  	}
		public static boolean jk(String s) {
			boolean f=true;
			for(int i=0;i<s.length();i++) {
				if(s.charAt(i)=='0') {
					f=false;break;
				}else f=true;
			}
			return f;
		}
		//product of digits
		public static long product(int n) {
			int k=1;
			for( ;n>0;n=n/10) {
				k=k*(n%10);
			}
			return k;
		}public static long product2(int o) {
			int k=1;
			for( ;o>0;o=o/10) {
				k=k*(o%10);
			}
			return k;
		}
		
		public static int lol(String s) {long f=1;
			
		    	for(int j=0;j<s.indexOf('0')-1;j++) {
		    		int k=s.charAt(j);f*=(k-48);//System.out.println(f);
		    	}
		    	if(s.charAt(s.indexOf('0')-1)=='1') {
		    		int y=(int) (Math.pow(9,s.length()-s.indexOf('0')+1));int u=(int) (f*y);
		    		return u;
		    	}else {
		    		int y=(int) (Math.pow(9,s.length()-s.indexOf('0')));//System.out.println(y);
		    		int o=s.charAt(s.indexOf('0')-1);int l=o-48-1;
		    		f=f*y;//System.out.println(f);
		    		f=f*l;
		    	return (int) f;}
		}
		public static int lol2(String d) {long f=1;
		
    	for(int j=0;j<d.indexOf('0')-1;j++) {
    		int k=d.charAt(j);f*=(k-48);//System.out.println(f);
    	}
    	if(d.charAt(d.indexOf('0')-1)=='1') {
    		int y=(int) (Math.pow(9,d.length()-d.indexOf('0')));int u=(int) (f*y);
    		return u;
    	}else {
    		int y=(int) (Math.pow(9,d.length()-d.indexOf('0')));//System.out.println(y);
    		int o=d.charAt(d.indexOf('0')-1);int l=o-48-1;
    		f=f*y;//System.out.println(f);
    		f=f*l;
    	return (int) f;}
}
	
		
		public static int digits(int n) {
			int u=0;
			while(n!=0) {
				u++;n=n/10;
			}
			return u;
		}
		
		public static void main (String args[])throws NumberFormatException, IOException, InterruptedException
				    {
				    	Scanner sc=new Scanner(System.in);
				    	int n=sc.nextInt();int w=sc.nextInt();int a[]=new int[n];
				    	for(int i=0;i<n;i++) 	a[i]=sc.nextInt();int p = 0;int freeplaces=0;int busyplaces=0;
				    	for(int i=0;i<a.length;i++) {
				    		p+=a[i];
				    		 freeplaces=Math.min(freeplaces,p);
				    		 busyplaces=Math.max(busyplaces,p);
				    	}
				    	System.out.println(Math.max(w-(busyplaces-freeplaces)+1,0));
				    	
				       
				    }
				    	
				    	
				    

				    
				    	
//				    	System.out.println(Arrays.toString(a));
//				    	System.out.println(Arrays.toString(b));
				    	
				    
			      static int binarySearch(int a[],int x) {
			    	  int l=0;int h=a.length-1;int mid =(l+h)/2;
			    	  
			    		l=0;h=a.length-1;  mid=(l+h)/2;
			    		  for( ;l<=h;) {mid=(l+h)/2;
			    		  if(x==a[mid])return mid;
			    		  else if(x>a[mid])l=mid+1;
			    		  else  h=mid-1;
			    	  
			    	  }
			    	  return -1;
			      }
			      
			   
			      
			      
			      
			      




				//	Bubble Sort    
			      static void bubbleSort(int a[]) 
			      { 
			          int n = a.length; 
			          for (int i = 0; i < n-1; i++) 
			              for (int j = 0; j < n-i-1; j++) 
			                  if (a[j] > a[j+1]) 
			                  { 
			                      // swap arr[j+1] and arr[i] 
			                      int temp = a[j]; 
			                      a[j] = a[j+1]; 
			                      a[j+1] = temp; 
			                  } 
			      }      
			    //Merge Sort
			      
			      	public static void mergeSort(int[] a, int n) {
			      	    if (n < 2) {
			      	        return;
			      	    }
			      	    int mid = n / 2;
			      	    int[] l = new int[mid];
			      	    int[] r = new int[n - mid];
			      	 
			      	    for (int i = 0; i < mid; i++) {
			      	        l[i] = a[i];
			      	    }
			      	    for (int i = mid; i < n; i++) {
			      	        r[i - mid] = a[i];
			      	    }
			      	    mergeSort(l, mid);
			      	    mergeSort(r, n - mid);
			      	 
			      	    merge(a, l, r, mid, n - mid);
			      	}
			      	
			      	public static void merge(
			      			  int[] a, int[] l, int[] r, int left, int right) {
			      			  
			      			    int i = 0, j = 0, k = 0;
			      			    while (i < left && j < right) {
			      			        if (l[i] <= r[j]) {
			      			            a[k++] = l[i++];
			      			        }
			      			        else {
			      			            a[k++] = r[j++];
			      			        }
			      			    }
			      			    while (i < left) {
			      			        a[k++] = l[i++];
			      			    }
			      			    while (j < right) {
			      			        a[k++] = r[j++];
			      			    }
			      			}
			      //Comparable Class to sort 2d array[n][2] according the first column
			    	
			      
			      static class Scanner {
				  		StringTokenizer st;
				  		BufferedReader br;

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

				  		public Scanner(String file) throws Exception {
				  			br = new BufferedReader(new FileReader(file));
				  		}

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

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

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

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

				  		public char nextChar() throws IOException {
				  			return next().charAt(0);
				  		}

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

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

				  		public void waitForInput() throws InterruptedException {
				  			Thread.sleep(3000);
				  		}
				  	}
			      }
				 