#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (auto& i : a) cin >> i;
  vector<long long> b(n);
  long long x;
  cin >> x;
  for (auto& i : b) cin >> i;
  set<long long> s;
  long long sol = 0;
  long long t = k;
  for (long long i = 0; i < n; ++i) {
    t += x;
    if (a[i] > t) return cout << "-1\n", 0;
  }
  for (long long i = 0; i < n; ++i) {
    s.insert(b[i]);
    while (a[i] > k) {
      k += x;
      sol += *s.begin();
      s.erase(s.begin());
    }
  }
  cout << sol << '\n';
}
