#include <bits/stdc++.h>
const int maxn = 1e5 + 5;
using namespace std;
int sum[1005], a[1005];
int main() {
  int i, j, k;
  int n, mx = 0, mn = 0;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] = sum[i - 1] + a[i];
    mn = min(mn, sum[i]);
    mx = max(mx, sum[i]);
  }
  printf("%d\n", max(k - mx + mn + 1, 0));
  return 0;
}
