#include <bits/stdc++.h>
using namespace std;
long long n, K;
long long X[200000], C[200000];
long long A;
set<long long> S;
long long output;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> K;
  for (long long i = 0; i < n; i++) cin >> X[i];
  cin >> A;
  long long key = 0;
  for (long long i = 0; i < n; i++) cin >> C[i];
  for (long long i = 0; i < n; i++) {
    S.insert(C[i]);
    while (S.empty() == 0 && K < X[i]) {
      K += A;
      output += *S.begin();
      S.erase(S.begin());
    }
    if (K < X[i]) {
      key = 1;
      break;
    }
  }
  if (key == 1) output = -1;
  cout << output;
  return 0;
}
