#include <bits/stdc++.h>
using namespace std;
const int MAKS = 300100;
const int INF = 1e9 + 1;
const long long LINF = 1e17;
priority_queue<int, vector<int>, greater<int> > pq;
int n, k, A, a[MAKS], b[MAKS], now;
long long ans, x, maks;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> A;
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) {
    x = a[i] - k;
    x = ceil((long double)x / (long double)A);
    now = x;
    pq.push(b[i]);
    if (maks >= x)
      now = 0;
    else
      now = x - maks;
    maks = max(maks, x);
    if (pq.size() < now) {
      printf("-1\n");
      return 0;
    }
    while (now--) {
      ans += (long long)pq.top();
      pq.pop();
    }
  }
  cout << ans;
}
