#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1005;
int a[MAX_N];
int n, w;
int main() {
  scanf("%d %d", &n, &w);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 2; i <= n; i++) {
    a[i] += a[i - 1];
  }
  int res = w;
  for (int i = 1; i <= n; i++) {
    res = min(res, w - a[i]);
  }
  int maxi = 1000000007;
  for (int i = 1; i <= n; i++) {
    maxi = min(maxi, a[i]);
  }
  res++;
  if (maxi < 0) {
    maxi = -maxi;
  } else {
    maxi = 0;
  }
  cout << max(0, res - maxi);
  return 0;
}
