#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  long long t = 1;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long ar[n];
    for (long long i = 0; i < n; i++) cin >> ar[i];
    long long gain;
    cin >> gain;
    long long cost[n];
    for (long long i = 0; i < n; i++) cin >> cost[i];
    multiset<long long> s;
    long long cnt = 0, ans = 0;
    for (long long i = 0; i < n; i++) {
      s.insert(cost[i]);
      if (ar[i] > k + cnt * gain) {
        while (s.size() > 0 && ar[i] > k + cnt * gain) {
          cnt++;
          ans += *s.begin();
          s.erase(s.begin());
        }
        if (ar[i] > k + cnt * gain) {
          ans = -1;
          break;
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
