#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll nax = 1e5 + 12;
ll dp[nax][6], all[nax][6];
ll a[nax];
ll c[nax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  for (ll i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ll gain;
  cin >> gain;
  for (ll i = 1; i <= n; i++) {
    cin >> c[i];
  }
  multiset<ll> pq;
  ll now = k, ans = 0;
  for (ll i = 1; i <= n; i++) {
    pq.insert(c[i]);
    if (a[i] > now) {
      ll need = (a[i] - now + gain - 1) / gain;
      if (pq.size() < need) {
        cout << -1 << '\n';
        return 0;
      }
      while (!pq.empty() && need--) {
        ans += *pq.begin();
        now += gain;
        pq.erase(pq.begin());
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
