#include <bits/stdc++.h>
using namespace std;
void seive(long long n, vector<long long> &prime) {
  prime[1] = 1;
  long long i, j;
  for (i = 2; i < n; i++) {
    if (prime[i] == 1) {
      for (j = i * i; j < n; j += i) prime[j] = 0;
    }
  }
}
void dfs(long long second, vector<vector<long long> > &a,
         vector<long long> &vis, long long &c) {
  vis[second] = 1;
  long long i;
  c++;
  for (i = 0; i < a[second].size(); i++) {
    if (!vis[a[second][i]]) dfs(a[second][i], a, vis, c);
  }
}
bool isPrime(long long n) {
  if (n <= 1) return true;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long n, k, second, i;
  cin >> n >> k;
  long long a[n], b[n], p[n];
  for (i = 0; i < n; i++) cin >> a[i];
  cin >> second;
  for (i = 0; i < n; i++) cin >> p[i];
  for (i = 0; i < n; i++) {
    b[i] = ceil((a[i] - k) / (double)second);
    if (b[i] > i + 1) {
      cout << -1;
      return 0;
    }
  }
  multiset<long long> m;
  long long c = 0, an = 0;
  for (i = 0; i < n; i++) {
    m.insert(p[i]);
    while (b[i] - c > 0) {
      an += *m.begin();
      m.erase(m.begin());
      c++;
    }
  }
  cout << an;
}
