#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, k, a;
int x[100005], c[100005], vis[100005];
struct node {
  int idx;
  int val;
} t[100005];
int cmp(node a, node b) {
  if (vis[a.idx] != vis[b.idx]) {
    return vis[a.idx] > vis[b.idx];
  } else {
    return a.val < b.val;
  }
}
int main() {
  int flag = 1, cnt = 0, tcnt = 0;
  long long ans = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  scanf("%d", &a);
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
    t[i].val = c[i];
    t[i].idx = i;
  }
  for (int i = 0; i < n; i++) {
    if (x[i] > k) {
      sort(t + tcnt, t + i + 1, cmp);
      int j = tcnt;
      tcnt = cnt;
      while (j <= i && k < x[i]) {
        if (vis[t[j].idx]) {
          j++;
          continue;
        }
        ans += t[j].val;
        k += a;
        vis[t[j].idx] = 1;
        cnt++;
        j++;
      }
      if (k < x[i]) flag = 0;
    }
    if (flag == 0) break;
  }
  if (flag) {
    printf("%llu\n", ans);
  } else {
    puts("-1");
  }
  return 0;
}
