#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, w, k, i = 0, mi = 0, ma = 0;
  cin >> n >> w;
  while (n--) {
    cin >> k;
    i += k;
    ma = max(i, ma);
    mi = min(i, mi);
  }
  ma = w - ma;
  if (ma + mi + 1 <= 0)
    cout << "0";
  else
    cout << ma + mi + 1;
}
