#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
T gcd(T a, T b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> x(n);
  for (int i = 0; i < (int)(n); i++) cin >> x[i];
  long long a;
  cin >> a;
  vector<long long> c(n);
  for (int i = 0; i < (int)(n); i++) cin >> c[i];
  long long cur = k;
  long long cost = 0;
  multiset<long long> pos;
  for (int i = 0; i < (int)(n); i++) {
    pos.insert(c[i]);
    if (cur < x[i]) {
      long long div = ((x[i] - cur) + a - 1) / a;
      if (div > (int)pos.size()) {
        cout << -1 << endl;
        return 0;
      }
      int cnt = 0;
      vector<long long> er;
      for (auto x : pos) {
        cost += x;
        er.push_back(x);
        cnt++;
        if (div == cnt) break;
      }
      for (int j = 0; j < (int)(er.size()); j++) pos.erase(pos.find(er[j]));
      cur += (div * a);
    }
  }
  cout << cost << endl;
  return 0;
}
