#include <bits/stdc++.h>
using namespace std;
int n, a, sum, high, w, low;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << setprecision(10) << fixed;
  cin >> n >> w;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    sum += a;
    if (sum > high) {
      high = sum;
    }
    if (sum < low) {
      low = sum;
    }
  }
  cout << max(w - high + 1 + low, 0) << '\n';
  return 0;
}
