#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
const double eps = 1e-9;
const int inf = 1e9;
long long ans, p, k;
long long a[mx], c[mx];
bool vis[mx];
multiset<int> S;
int n;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> p;
  for (int i = 0; i < n; i++) cin >> c[i];
  int l = 0, r = 0;
  while (l < n) {
    if (a[r] <= k) {
      if (!vis[r]) S.insert(c[r]);
      if (r == n - 1) break;
      r++;
      continue;
    }
    if (!vis[r]) {
      S.insert(c[r]);
      vis[r] = 1;
    }
    int sz = S.size();
    if (!sz || 1ll * sz * p + k < a[r]) {
      printf("-1");
      return 0;
    }
    auto x = S.begin();
    ans += *x;
    S.erase(S.find(*x));
    k += p;
    ++l;
  }
  cout << ans;
}
