#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int lift;
  cin >> lift;
  vector<int> c(n);
  for (int i = 0; i < n; i++) cin >> c[i];
  set<int> second;
  ll ans = 0;
  int joker;
  for (int i = 0; i < n; i++) {
    second.insert(c[i]);
    if (v[i] <= k)
      continue;
    else {
      joker = (v[i] - k) / lift;
      if ((v[i] - k) % lift != 0) joker++;
      if (joker > second.size()) {
        ans = -1;
        break;
      }
      k += (joker * lift);
      int mini;
      while (joker--) {
        mini = *min_element(second.begin(), second.end());
        ans += mini;
        second.erase(mini);
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
