#include <bits/stdc++.h>
using namespace std;
int cs = 1;
void file();
int dx[] = {+0, +0, -1, +1};
int dy[] = {+1, -1, +0, +0};
int X[] = {+0, +0, +1, -1, -1, +1, -1, +1};
int Y[] = {-1, +1, +0, +0, +1, +1, -1, -1};
int kx[] = {-2, -2, -1, -1, 1, 1, 2, 2};
int ky[] = {-1, 1, -2, 2, -2, 2, -1, 1};
template <class mpX>
mpX GCD(mpX a, mpX b) {
  return b == 0 ? a : GCD(b, a % b);
}
template <class mpX>
mpX LCM(mpX a, mpX b) {
  return a * (b / GCD(a, b));
}
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
const int lim = 1e5 + 123;
void solve() {
  long long n, cal;
  cin >> n >> cal;
  vector<pair<long long, long long>> v;
  for (int i = 0; i < n; i++) {
    long long tem;
    cin >> tem;
    v.push_back({tem, 0});
  }
  long long a;
  cin >> a;
  for (int i = 0; i < n; i++) {
    long long tem;
    cin >> tem;
    v[i].second = tem;
  }
  priority_queue<long long, vector<long long>, greater<long long>> pq;
  bool ckr = true;
  long long cost = 0;
  for (int i = 0; i < n; i++) {
    pq.push(v[i].second);
    if (cal < v[i].first) {
      while (!pq.empty()) {
        cal += a;
        cost += pq.top();
        pq.pop();
        if (cal >= v[i].first) break;
      }
    }
    if (cal < v[i].first) {
      ckr = false;
      break;
    }
  }
  if (ckr)
    cout << cost << endl;
  else
    cout << "-1" << endl;
}
int main() {
  int t;
  solve();
  return 0;
}
void file() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
