#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, w;
  cin >> n >> w;
  int sum = 0;
  int mx = 0, mn = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    sum += x;
    mn = min(mn, sum);
    mx = max(mx, sum);
  }
  cout << max(0, w - mx + mn + 1);
}
