#include <bits/stdc++.h>
using namespace std;
int i, n, a[100005], A, b[100005];
long long m, ans;
set<int> s;
int main() {
  scanf("%d %lld", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%d", &A);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= n; i++) {
    s.insert(b[i]);
    while (s.size() && m < a[i]) {
      ans += *s.begin();
      s.erase(s.begin());
      m += A;
    }
    if (m < a[i]) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
