#include <bits/stdc++.h>
using namespace std;
multiset<int> m;
multiset<int>::const_iterator it;
int x[100001], c[100001];
int main() {
  bool moguce = true;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k, i, a;
  long long suma = 0, tren;
  cin >> n >> k;
  tren = (long long)k;
  for (i = 0; i < n; i++) cin >> x[i];
  cin >> a;
  for (i = 0; i < n; i++) cin >> c[i];
  for (i = 0; i < n; i++) {
    m.insert(c[i]);
    if (tren < x[i]) {
      if ((long long)k + (long long)a * (1 + i) < x[i]) {
        moguce = false;
        break;
      } else {
        while (tren < x[i]) {
          it = m.begin();
          suma = suma + (long long)*it;
          m.erase(it);
          tren = tren + (long long)a;
        }
      }
    }
    if (moguce == false) break;
  }
  if (moguce == false)
    cout << -1;
  else
    cout << suma;
  return 0;
}
