#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > q;
int tar[100005];
int n, k, add;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> tar[i];
  long long ans = 0;
  cin >> add;
  int tmp;
  for (int i = 1; i <= n; i++) {
    cin >> tmp;
    q.push(tmp);
    while (k < tar[i]) {
      if (q.empty()) {
        cout << -1 << endl;
        return 0;
      }
      k += add;
      ans += q.top();
      q.pop();
    }
  }
  cout << ans << endl;
}
