#include <bits/stdc++.h>
using namespace std;
int main() {
  long long minn = 0, maxx = 0;
  long long n, w;
  cin >> n >> w;
  long long a;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    sum += a;
    if (sum > maxx) maxx = sum;
    if (sum < minn) minn = sum;
  }
  maxx = w - maxx;
  minn = 0 - minn;
  if (maxx - minn < 0) {
    cout << 0;
    return 0;
  }
  cout << maxx - minn + 1;
  return 0;
}
