#include <bits/stdc++.h>
using namespace std;
int n, a[1111], w;
void xl() {
  cin >> n >> w;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int s = 0, vmin = INT_MAX, vmax = INT_MIN;
  for (int i = 1; i <= n; i++) {
    s += a[i];
    if (s < vmin) {
      vmin = s;
    }
    if (s > vmax) {
      vmax = s;
    }
  }
  if (max(-vmin, 0) <= w - max(vmax, 0))
    cout << w - max(vmax, 0) - max(-vmin, 0) + 1 << endl;
  else
    cout << 0 << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  xl();
}
