#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  for (int i = (0); i < (n); i++) cin >> v[i];
  long long a;
  cin >> a;
  vector<long long> c(n);
  for (int i = (0); i < (n); i++) cin >> c[i];
  long long costo = 0;
  int w = 0;
  map<long long, long long> m;
  while (w < n) {
    m[c[w]]++;
    if (v[w] > k) {
      while (v[w] > k && !m.empty()) {
        pair<long long, long long> it = *m.begin();
        m[it.first]--;
        if (it.second - 1 == 0) m.erase(it.first);
        costo += it.first;
        k += a;
      }
      if (v[w] > k) {
        cout << -1 << endl;
        return 0;
      }
    }
    w++;
  }
  cout << costo << endl;
  return 0;
}
