#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e5 + 5;
long long n, k, x[N], c[N], a;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> x[i];
  cin >> a;
  long long ans = 0;
  priority_queue<long long> best;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    best.push(-c[i]);
    while (!best.empty() && k < x[i]) {
      k += a;
      ans -= best.top();
      best.pop();
    }
    if (best.empty() && k < x[i]) {
      cout << -1 << "\n";
      return 0;
    }
  }
  cout << ans << "\n";
}
