#include <bits/stdc++.h>
using namespace std;
int64_t inf = 1000 * 1000 * 1000;
int64_t inf64 = inf * inf;
int64_t mod = 228228227;
int64_t nll = 0;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr << fixed << setprecision(8);
  srand(time(0));
  auto START_TIME = chrono::high_resolution_clock::now();
  int32_t n, k;
  cin >> n >> k;
  vector<int64_t> a(n);
  for (int32_t i = 0; i < n; ++i) cin >> a[i];
  int64_t t;
  cin >> t;
  vector<int64_t> x(n);
  for (int32_t i = 0; i < n; ++i) cin >> x[i];
  multiset<int64_t> c;
  int64_t ans = 0;
  for (int32_t i = 0; i < n; ++i) {
    c.insert(x[i]);
    while (k < a[i] && c.size()) {
      k += t;
      ans += *c.begin();
      c.erase(c.begin());
    }
    if (k < a[i] && c.empty()) {
      cout << -1;
      return 0;
    }
  }
  cout << ans;
  cerr << endl
       << chrono::duration<long double>(chrono::high_resolution_clock::now() -
                                        START_TIME)
              .count()
       << " sec.";
}
