#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, w;
  long long mx = 0, mn = 0, sum = 0;
  scanf("%d %d", &n, &w);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    sum += a;
    mx = max(mx * 1LL, sum);
    mn = min(mn * 1LL, sum);
  }
  mn = abs(mn);
  int ans = (w - mx) - mn + 1;
  ans = max(ans, 0);
  cout << ans << endl;
}
