#include <bits/stdc++.h>
using namespace std;
long long Inf = 1e18;
priority_queue<long long, vector<long long>, greater<long long>> pq;
long long Ans, a[100100], c[100100], p, n, k;
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];
  }
  for (int i = 0; i < n; i++) {
    pq.push(c[i]);
    if (k >= a[i]) continue;
    while (!pq.empty() && k < a[i]) {
      long long cost = pq.top();
      pq.pop();
      k += p;
      Ans += cost;
    }
    if (pq.empty() && k < a[i]) {
      cout << -1 << '\n';
      return 0;
    }
  }
  cout << Ans << '\n';
  return 0;
}
