#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int a;
  cin >> a;
  long long int ans = 0, power = 0;
  power = k;
  priority_queue<int, vector<int>, greater<int> > Q;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    Q.push(t);
    if (v[i] <= power) continue;
    while (power < v[i]) {
      if (Q.empty()) return cout << "-1", 0;
      power += a;
      ans += Q.top();
      Q.pop();
    }
  }
  cout << ans;
  return 0;
}
