#include <bits/stdc++.h>
using namespace std;
int Max = 0;
int Min = 0;
int tmp = 0;
int main() {
  int n, w;
  cin >> n >> w;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    tmp += x;
    if (tmp > Max) Max = tmp;
    if (tmp < Min) Min = tmp;
  }
  Max -= Min;
  if (Max > w)
    cout << 0;
  else
    cout << w - Max + 1;
}
