#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k, a;
  cin >> n >> k;
  int x[n];
  for (int i = 0; i < n; i++) cin >> x[i];
  cin >> a;
  priority_queue<int, vector<int>, greater<int> > q;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    q.push(c);
    while (k < x[i])
      if (q.empty()) {
        cout << -1;
        return 0;
      } else {
        k += a;
        sum += q.top();
        q.pop();
      }
  }
  cout << sum;
}
