#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long plan[n];
  for (int i = 0; i < n; i++) cin >> plan[i];
  long long A;
  cin >> A;
  long long cost[n];
  for (int i = 0; i < n; i++) cin >> cost[i];
  multiset<long long> s;
  long long flag = 1, ans = 0;
  for (int i = 0; i < n; i++) {
    s.insert(cost[i]);
    if (plan[i] > k) {
      while (k < plan[i] && (int)s.size() != 0) {
        k += A;
        ans += *s.begin();
        s.erase(s.begin());
      }
      if (k < plan[i]) {
        flag = 0;
        break;
      }
    }
  }
  if (flag)
    cout << ans;
  else
    cout << "-1";
  return 0;
}
