#include <bits/stdc++.h>
using namespace std;
map<long long, map<long long, long long>> m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, intial;
  cin >> n >> intial;
  long long arr[n + 3];
  long long high = 0;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long sum = 0;
  long long flag = 0;
  long long gains;
  cin >> gains;
  long long cost[n + 3];
  set<pair<long long, long long>> s;
  for (long long i = 0; i < n; i++) {
    cin >> cost[i];
  }
  for (long long i = 0; i < n; i++) {
    s.insert(make_pair(cost[i], i));
    long long ans = arr[i] - intial;
    if (ans > 0 && ans % gains != 0) {
      ans = (ans / gains) + 1;
    } else {
      ans = ans / gains;
    }
    if (ans <= 0) {
      continue;
    } else {
      long long p = 0;
      if (ans > s.size()) {
        flag = -1;
      } else {
        set<pair<long long, long long>> g;
        for (auto it = s.begin(); it != s.end(); it++) {
          p++;
          set<pair<long long, long long>>::iterator ha = it;
          pair<long long, long long> h = *it;
          sum += h.first;
          g.insert(h);
          intial += gains;
          if (s.size() == 0) {
            if (intial < arr[i]) {
              flag = -1;
            }
            break;
          }
          if (p == ans) {
            break;
          }
        }
        for (auto its = g.begin(); its != g.end(); its++) {
          pair<long long, long long> gs = *its;
          auto imp = s.find(gs);
          s.erase(imp);
        }
      }
      if (intial < arr[i]) {
        flag = -1;
        break;
      }
    }
  }
  if (flag == -1) {
    cout << "-1"
         << "\n";
  } else {
    cout << sum << "\n";
  }
}
