#include <bits/stdc++.h>
using namespace std;
const int maxx = 200010;
priority_queue<long long, vector<long long>, greater<long long> > q;
long long n, m, k;
long long ans = 0, total = 0, sum = 0;
long long a[maxx], c[maxx];
int main() {
  scanf("%lld%lld", &n, &k);
  for (register int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  scanf("%lld", &m);
  for (register int i = 1; i <= n; i++) scanf("%lld", &c[i]);
  for (register int i = 1; i <= n; i++) {
    q.push(c[i]);
    while (k < a[i] && !q.empty()) {
      ans += q.top();
      q.pop();
      k += m;
    }
    if (k < a[i] && q.empty()) {
      printf("-1");
      return 0;
    }
  }
  printf("%lld", ans);
  return 0;
}
