#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  char c;
  while (!isdigit(c = getchar()))
    ;
  x = c - 48;
  while (isdigit(c = getchar())) x = x * 10 + c - 48;
}
using namespace std;
using ll = int64_t;
int n, k, A;
int a[100005];
int c[100005];
set<int> s;
int main() {
  read(n);
  read(k);
  for (int i = 1; i <= n; i++) read(a[i]);
  read(A);
  for (int i = 1; i <= n; i++) read(c[i]);
  ll res = 0, cur = k;
  for (int i = 1; i <= n; i++) {
    s.insert(c[i]);
    if ((ll)A * i + k < a[i]) return cout << -1, 0;
    while (cur < a[i]) {
      cur += A;
      int val = *s.begin();
      res += val;
      s.erase(val);
    }
  }
  cout << res;
}
