#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1e6 + 100;
const int mod = 998244353;
int n, k;
priority_queue<int> q;
int x[maxn], a[maxn];
int main() {
  scanf("%d", &n);
  scanf("%d", &k);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  long long ans = 0;
  int A;
  scanf("%d", &A);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    q.push(-a[i]);
    while (!q.empty() && k < x[i]) {
      ans -= q.top();
      q.pop();
      k += A;
    }
    if (q.empty() && k < x[i]) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
