#include <bits/stdc++.h>
using namespace std;
long long n, w, a[1123], d, mx, mn;
int main() {
  cin >> n >> w;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    d += a[i];
    mx = max(d, mx);
    mn = min(d, mn);
  }
  cout << max(w + 1 - mx + mn, 0ll);
}
