#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v, v1;
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  long long a, c = 0;
  cin >> a;
  for (long long i = 0; i < n; i++)
    if (v[i] > ((i + 1) * a + k)) c = -1;
  long long val = k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    v1.push_back(a);
  }
  long long sum = 0;
  if (c == 0) {
    for (long long i = 0; i < n; i++) {
      m[v1[i]]++;
      auto itr = m.begin();
      while (v[i] > val && itr != m.end()) {
        if (itr->second == 0 && itr != m.end()) {
          auto itr1 = itr;
          itr1++;
          m.erase(itr->first);
          itr = m.find(itr1->first);
        } else {
          val += a;
          sum += itr->first;
          (itr->second)--;
        }
      }
    }
    cout << sum << "\n";
  } else
    cout << "-1"
         << "\n";
}
