#include <bits/stdc++.h>
using namespace std;
long long read() {
  char c;
  long long x = 0, y = 1;
  while (c = getchar(), (c < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    y = -1;
  else
    x = c - '0';
  while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
  return x * y;
}
long long n, v, sum, hi, lo;
int main() {
  n = read();
  v = read();
  v++;
  hi = -2e9;
  lo = 2e9;
  for (long long i = 1; i <= n; i++) {
    long long x = read();
    sum += x;
    hi = max(hi, sum);
    lo = min(lo, sum);
  }
  if (hi > 0) v -= hi;
  if (lo < 0) v += lo;
  printf("%I64d", max(1ll * 0, v));
  return 0;
}
