#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  ll k;
  cin >> n >> k;
  vector<int> x(n);
  for (int &i : x) {
    cin >> i;
  }
  ll ans = 0;
  int a;
  cin >> a;
  priority_queue<int, vector<int>, greater<int>> pq;
  for (int i = 0; i < n; ++i) {
    int c;
    cin >> c;
    pq.push(c);
    if (x[i] > k) {
      int need = (x[i] - k + a - 1) / a;
      if (pq.size() < need) {
        cout << -1;
        return 0;
      }
      while (need--) {
        ans += pq.top();
        k += a;
        pq.pop();
      }
    }
  }
  cout << ans;
  return 0;
}
