#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void ran() { srand(chrono::steady_clock::now().time_since_epoch().count()); }
long long get_rand() {
  long long a = rand();
  long long b = rand();
  return a * (RAND_MAX + 1ll) + b;
}
void solve() {
  long long n;
  cin >> n;
  long long arr[n];
  long long i;
  long long tr = n / 2;
  if (n % 2 == 1) tr++;
  for (i = 0; i < tr; i++) cin >> arr[i];
  long long x;
  cin >> x;
  for (; i < n; i++) {
    arr[i] = x;
  }
  long long pf[n + 1];
  pf[0] = 0;
  for (long long i = 0; i < n; i++) {
    pf[i + 1] = pf[i] + arr[i];
  }
  if (pf[n] > 0) {
    cout << n << endl;
    exit(0);
  }
  vector<long long> all_before_less;
  for (long long i = 0; i < n; i++) {
    if (pf[i] < pf[n]) {
      all_before_less.push_back(n - i);
    }
  }
  if (all_before_less.empty()) {
    cout << -1 << endl;
    return;
  }
  random_shuffle(all_before_less.begin(), all_before_less.end());
  long long t = all_before_less.size();
  for (long long i = 0; i < min(t, 50ll); i++) {
    long long f = all_before_less[i];
    bool ok = true;
    for (long long j = f; j <= n; j++) {
      if (pf[j] <= pf[j - f]) {
        ok = false;
      }
    }
    if (ok) {
      cout << f << endl;
      return;
    }
  }
  cout << -1 << endl;
}
signed main() {
  ran();
  fast();
  long long t = 1;
  while (t--) {
    solve();
  }
}
