#include <bits/stdc++.h>
using namespace std;
int a[1010], mn = 0, mx = 0;
int main() {
  ios_base::sync_with_stdio(0);
  int n, w;
  cin >> n >> w;
  for (int i = 0; i < n; i++) cin >> a[i];
  int now = 0;
  for (int i = 0; i < n; i++) {
    now += a[i];
    mx = max(mx, now);
    mn = min(mn, now);
  }
  cout << max(0, w - mx + mn + 1) << endl;
}
