#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long n, w, a[1005], maxx = -inf, minn = inf, ans1, ans2;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> w;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] += a[i - 1];
    maxx = max(maxx, a[i]);
    minn = min(minn, a[i]);
  }
  minn = min(minn, 0LL);
  maxx = max(maxx, 0LL);
  ans1 = w - maxx;
  ans2 = -minn;
  cout << max(0LL, ans1 - ans2 + 1);
  return 0;
}
