#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(228);
using namespace std;
const unsigned long long inf = 1e7;
int main() {
  unsigned long long n, k, a, cnt = 0, mx = 0, mx_i = 0;
  bool ok = 1;
  cin >> n >> k;
  vector<unsigned long long> x(n), c(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
    if (mx < x[i]) {
      mx_i = i;
      mx = x[i];
    }
  }
  cin >> a;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  multiset<unsigned long long> s;
  for (int i = 0; i < n; ++i) {
    s.insert(c[i]);
    if (k < x[i]) {
      while (k < x[i] && s.size() > 0) {
        k += a;
        cnt += *s.begin();
        s.erase(s.begin());
      }
    }
    if (k < x[i]) {
      ok = 0;
      break;
    }
  }
  if (k == 0) cout << "mdaaa\n";
  if (ok)
    cout << cnt;
  else
    cout << -1;
  return 0;
}
