#include <bits/stdc++.h>
using namespace std;
const char NL = '\n';
long long int mod = 1000000007;
clock_t startTime;
double getCurrentTime() {
  return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
void read(vector<long long int> &a) {
  for (auto &it : a) cin >> it;
}
inline void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> x(n);
  read(x);
  long long int a;
  cin >> a;
  vector<long long int> pri(n);
  read(pri);
  long long int sum = k;
  multiset<long long int> st;
  long long int price = 0;
  bool ok = 1;
  for (long long int i = 0; i < n; i++) {
    st.insert(pri[i]);
    while (sum < x[i] && !st.empty()) {
      sum += a;
      price += *st.begin();
      st.erase(st.begin());
    }
    if (sum < x[i]) ok = 0;
  }
  if (!ok) {
    cout << -1 << NL;
    return;
  }
  cout << price << NL;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  startTime = clock();
  solve();
  fflush(stdin);
  fflush(stdout);
  return 0;
}
