#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, w;
  scanf("%lld", &n);
  scanf("%lld", &w);
  long long ar[n];
  for (long long i = 0; i < n; i++) scanf("%lld", &ar[i]);
  for (long long i = 1; i < n; i++) ar[i] += ar[i - 1];
  long long mn = 1000000007, mx = -1000000007;
  for (long long i = 0; i < n; i++) {
    mn = min(mn, ar[i]);
    mx = max(mx, ar[i]);
  }
  long long l, r;
  if (mn < 0) {
    l = abs(mn);
  } else {
    l = 0;
  }
  if (mx > 0) {
    r = w - mx;
  } else {
    r = w;
  }
  if (l <= r)
    cout << r - l + 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
