#include <bits/stdc++.h>
using namespace std;
clock_t __START, __END;
double __TOTALTIME;
void _MS() { __START = clock(); }
void _ME() {
  __END = clock();
  __TOTALTIME = (double)(__END - __START) / CLOCKS_PER_SEC;
  cout << "Time: " << __TOTALTIME << " s" << endl;
}
const double E = 2.718281828;
const double PI = acos(-1.0);
const long long INF = (1LL << 60);
const int inf = (1 << 30);
const double ESP = 1e-9;
const int mod = (int)1e9 + 7;
const int N = (int)1e6 + 10;
long long a[N];
long long val[N];
priority_queue<long long, vector<long long>, greater<long long> > q;
signed main() {
  long long n, k, m;
  long long ans = 0;
  scanf("%lld%lld", &n, &k);
  for (long long i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  scanf("%lld", &m);
  for (long long i = 1; i <= n; ++i) scanf("%lld", &val[i]);
  for (long long i = 1; i <= n; ++i) {
    q.push(val[i]);
    while (!q.empty() && k < a[i]) ans += q.top(), q.pop(), k += m;
    if (k < a[i]) {
      printf("-1");
      return 0;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
