#include <bits/stdc++.h>
using namespace std;
multiset<long long> m;
int main() {
  long long n, k, a;
  cin >> n >> k;
  vector<long long> x(n);
  vector<long long> c(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  cin >> a;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    m.insert(c[i]);
    while (k < x[i]) {
      if (m.size() == 0) {
        cout << -1 << endl;
        return 0;
      }
      ans += *m.begin();
      m.erase(m.begin());
      k += a;
    }
  }
  cout << ans << endl;
  return 0;
}
