#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, ad, ans = 0;
  cin >> n >> k;
  vector<long long> we(n);
  vector<long long> cos(n);
  for (int i = 0; i < n; i++) {
    cin >> we[i];
  }
  cin >> ad;
  set<long long> ard;
  bool ans1 = true;
  for (int i = 0; i < n; i++) {
    cin >> cos[i];
    ard.insert(cos[i]);
    if (k < we[i]) {
      while (we[i] > k && ard.size() >= 1) {
        k += ad;
        ans += *ard.begin();
        ard.erase(ard.begin());
      }
      if (we[i] > k) {
        ans1 = false;
      }
    }
  }
  if (!ans1) {
    ans = -1;
  }
  cout << ans << endl;
}
