#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
long long n, x, a[MAXN], suf[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int half = n / 2 + n % 2;
  for (int i = 0; i < half; i++) {
    cin >> a[i];
  }
  cin >> x;
  for (int i = half; i < n; i++) {
    a[i] = x;
  }
  for (int i = n - 1; i >= 0; i--) {
    suf[i] = suf[i + 1] + a[i];
  }
  if (x > 0) {
    cout << (suf[0] > 0 ? n : -1) << "\n";
  } else {
    int pref = 1e9;
    for (int i = 0; i < half; i++) {
      int b = lower_bound(suf + half, suf + n + 1, suf[i]) - suf - 1 - i;
      pref = min(pref, b);
      if (n - i <= pref) {
        cout << n - i << '\n';
        return 0;
      }
    }
    cout << "-1\n";
  }
  return 0;
}
