#include <bits/stdc++.h>   using namespace std;   template <class T>   void read(T &x) {     T res = 0, f = 1;     char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) {       res = (res << 3) + (res << 1) + c -  0 ;       c = getchar();     }     x = res * f;   }   const long long N = 200000 + 10;   long long w, a[N], n, mn = 1e13, mx = -1e13, sum;   int main() {     read(n), read(w);     for (int i = 1; i <= n; i++) {       read(a[i]);       sum += a[i];       mn = min(mn, sum);       mx = max(mx, sum);     }     if (abs(mx) > w || abs(mn) > w) {       printf( 0 );       return 0;     }     long long l = 0, r = w;     if (mn < 0) {       l = 0 - mn;     }     if (mx > 0) {       r = w - mx;     }     long long ans = r - l + 1;     if (ans > 0)       printf( %lld , r - l + 1);     else       printf( 0 );     return 0;   }   