#include <bits/stdc++.h>
int n;
int w;
std::vector<int> vahed;
int main() {
  std::cin >> n;
  std::cin >> w;
  for (int i = 0; i < n; i++) {
    int temp;
    std::cin >> temp;
    vahed.push_back(temp);
  }
  int summa = 0;
  int summa_max = 0;
  int summa_min = 0;
  for (int i = 0; i < n; i++) {
    summa += vahed[i];
    if (summa > summa_max) {
      summa_max = summa;
    }
    if (summa < summa_min) {
      summa_min = summa;
    }
  }
  int muutus = summa_max - summa_min;
  if (muutus < 0) {
    std::cout << 0;
  }
  if (muutus > w) {
    std::cout << 0;
  } else {
    std::cout << w - muutus + 1;
  }
}
