#include <bits/stdc++.h>
using namespace std;
const int32_t Accepted = 0;
template <typename T>
void in(T& x) {
  static char ch;
  static bool neg;
  for (ch = neg = 0; ch < '0' || '9' < ch; neg |= ch == '-', ch = getchar())
    ;
  for (x = 0; '0' <= ch && ch <= '9'; (x *= 10) += ch - '0', ch = getchar())
    ;
  x = neg ? -x : x;
}
template <typename T, typename... Types>
void in(T& x, Types&... oth) {
  static char ch;
  static bool neg;
  for (ch = neg = 0; ch < '0' || '9' < ch; neg |= ch == '-', ch = getchar())
    ;
  for (x = 0; '0' <= ch && ch <= '9'; (x *= 10) += ch - '0', ch = getchar())
    ;
  x = neg ? -x : x;
  in(oth...);
}
template <typename T>
T _pow_mod(T a, T b, T mod) {
  T base = a, res = 1;
  while (b) {
    if (b & 1) res = (res * base) % mod;
    base = (base * base) % mod;
    b >>= 1;
  }
  return res;
}
template <typename T>
T _pow(T a, T b) {
  T base = a, res = 1;
  while (b) {
    if (b & 1) res = (res * base);
    base = (base * base);
    b >>= 1;
  }
  return res;
}
template <typename T>
void out(T x) {
  char s[65];
  int32_t cnt = 0;
  if (x > 0)
    while (x > 0) s[cnt++] = (x - (x / 10 * 10)) + '0', x /= 10;
  else if (x < 0) {
    while (x < 0) s[cnt++] = (x / 10 * 10) - x + '0', x /= 10;
    s[cnt++] = '-';
  }
  if (cnt == 0)
    putchar('0');
  else
    for (int32_t i = cnt - 1; ~i; i--) putchar(s[i]);
}
template <typename T>
void print(T x) {
  out(x);
  putchar('\n');
}
template <typename T, typename... types>
void print(T x, types... oth) {
  out(x);
  putchar(' ');
  print(oth...);
}
const int32_t MAXN = 1e6 + 5;
long long a[MAXN];
long long cost[MAXN];
int32_t main() {
  int n;
  long long k;
  in(n, k);
  for (int i = 0; i < n; i++) {
    in(a[i]);
  }
  long long A;
  in(A);
  for (int i = 0; i < n; i++) {
    in(cost[i]);
  }
  priority_queue<long long, vector<long long>, greater<long long> > q;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    q.push(cost[i]);
    while (!q.empty() && k < a[i]) {
      k += A;
      sum += q.top();
      q.pop();
    }
    if (q.empty() && k < a[i]) {
      print(-1);
      exit(0);
    }
  }
  print(sum);
  return Accepted;
}
