#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> all(n);
  for (int i = 0; i < n; i++) cin >> all[i];
  long long maax;
  cin >> maax;
  vector<int> c(n);
  for (int i = 0; i < n; i++) cin >> c[i];
  long long out = 0;
  set<pair<int, int> > pos;
  for (int i = 0; i < n; i++) {
    pos.insert(make_pair(c[i], i));
    if (all[i] <= k) {
      continue;
    }
    while (all[i] > k && pos.size() > 0) {
      k += maax;
      auto tt = pos.begin();
      out += (*tt).first;
      pos.erase(tt);
    }
    if (all[i] > k) {
      cout << -1;
      return 0;
    }
  }
  cout << out;
}
