#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, w, x, sum = 0, mmax = 0, us = 0;
  cin >> n >> w;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    sum += x;
    us = min(us, sum);
    mmax = max(mmax, sum);
  }
  if (us < 0)
    us = -us;
  else
    us = 0;
  printf("%d\n", max(w - mmax - us + 1, 0));
  return 0;
}
