#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, h, l = 0, c = 0, a = 0, b = 0, d;
  cin >> n >> h;
  while (n--) {
    cin >> d;
    c += d;
    if (c > a)
      a = c;
    else if (c < b)
      b = c;
  }
  l -= b;
  h -= a;
  d = h - l + 1;
  if (d < 0) d = 0;
  cout << d;
  return 0;
}
