#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, i, j, k, l = 0, m, p = 0;
  cin >> n >> k;
  long long a[n], b[n];
  priority_queue<long long, vector<long long>, greater<long long> > pq;
  vector<long long> v, v1;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> m;
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (i = 0; i < n; i++) {
    pq.push(b[i]);
    while ((k < a[i]) && (pq.size() > 0)) {
      p = p + pq.top();
      k = k + m;
      pq.pop();
    }
    if (k < a[i]) {
      l = 1;
      cout << "-1" << endl;
      break;
    }
  }
  if (l == 0) cout << p << endl;
  return 0;
}
