#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, w;
  cin >> n >> w;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int maxx = a[0], minn = a[0];
  for (int i = 1; i < n; ++i) {
    a[i] += a[i - 1];
    maxx = max(maxx, a[i]);
    minn = min(minn, a[i]);
  }
  int start, end;
  if (maxx < 0) {
    start = -minn;
    end = w;
  } else if (minn > 0) {
    start = 0;
    end = w - maxx;
  } else {
    start = -minn;
    end = w - maxx;
  }
  if (start > end) {
    cout << 0;
  } else {
    cout << end - start + 1;
  }
  return 0;
}
