#include <bits/stdc++.h>
using namespace std;
long long a[1234];
long long sum[1234];
const long long inf = 1e10 + 7;
int main() {
  int n, w;
  cin >> n >> w;
  long long Min = inf, Max = -inf;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    sum[i] = a[i] + sum[i - 1];
    Min = min(Min, sum[i]);
    Max = max(Max, sum[i]);
  }
  if (abs(Min) > w || abs(Max) > w) {
    cout << 0 << "\n";
    return 0;
  }
  if (Max >= 0 && Min >= 0) {
    cout << w - Max + 1;
  }
  if (Max >= 0 && Min < 0) {
    if (w - Max + 1 - (-Min) < 0)
      cout << 0;
    else
      cout << w - Max + 1 - (-Min);
  }
  if (Max < 0) {
    cout << w - (-Min) + 1;
  }
}
