#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long arr[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  bool isPossible = 1;
  long long a;
  cin >> a;
  long long c[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> c[i];
  }
  long long mc = 0;
  set<long long> s;
  for (long long i = 1; i <= n; i++) {
    s.insert(c[i]);
    long long d = arr[i] - k;
    if (d <= 0) {
      continue;
    } else {
      while (!s.empty() && d > 0) {
        long long x = *s.begin();
        s.erase(s.begin());
        mc += x;
        d -= a;
        k += a;
      }
      if (d > 0) {
        mc = -1;
        break;
      }
    }
  }
  cout << mc << endl;
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
}
