#include <bits/stdc++.h>
using namespace std;
long long i, j, n, c[223456], d[223456], a[456789], l, r, s, t, tt, k, x, y, z,
    m, b[1111111];
string p, q, du, qq;
vector<long long> u[345678], uu, ui;
multiset<long long> mm;
int main() {
  cin >> n >> t;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  m = t;
  cin >> k;
  for (i = 0; i < n; i++) {
    cin >> b[i];
    mm.insert(b[i]);
    while (t < a[i]) {
      if (mm.empty()) {
        cout << -1;
        return 0;
      }
      s += *mm.begin();
      mm.erase(mm.begin());
      t += k;
    }
  }
  cout << s;
  return 0;
}
