#include <bits/stdc++.h>
using namespace std;
int n;
long long m, k, x, y, sum, cnt, a[100005], c[100005];
long long ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  scanf("%d %lld", &n, &k);
  for (int i = (1); i <= (n); i++) scanf("%lld", &a[i]);
  scanf("%lld", &m);
  for (int i = (1); i <= (n); i++) scanf("%lld", &c[i]);
  priority_queue<long long, vector<long long>, greater<long long> > pq;
  for (int i = (1); i <= (n); i++) {
    pq.push(c[i]);
    if (a[i] <= k)
      ;
    else {
      long long needed = (a[i] - k + m - 1) / m;
      k += needed * m;
      while (needed) {
        needed--;
        if (pq.empty()) {
          printf("-1\n");
          return 0;
        }
        ans += pq.top();
        pq.pop();
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
