#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1e3 + 10, maxm = 1e6 + 5, maxc = 26;
long long sum = 0, mi = 0, ma = 0;
int main() {
  int n, w, num;
  scanf("%d%d", &n, &w);
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    sum += num;
    mi = min(mi, sum);
    ma = max(ma, sum);
  }
  printf("%I64d\n", w - ma + mi + 1 <= 0 ? 0 : w - ma + mi + 1);
  return 0;
}
