#include <bits/stdc++.h>
using namespace std;
long long int mod(long long int x, long long int m) { return (x % m + m) % m; }
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1, r, n, a, d, c, b, x, y, sum, cnt, i, j, k, m, l, q, maxx,
                minn, temp, ans, flag, g, ts;
  long long int mod = 1000000007;
  char ch, chh;
  double dans;
  string str, ttr;
  for (ts = 1; ts <= t; ts++) {
    flag = 0;
    sum = 0;
    cnt = 0;
    ans = 0;
    k = 0;
    maxx = 0;
    minn = 0;
    a = 0;
    b = 0;
    temp = 0;
    cin >> n >> k;
    long long int arr[n];
    for (i = 0; i < n; i++) {
      cin >> arr[i];
    }
    cin >> temp;
    long long int brr[n];
    for (i = 0; i < n; i++) cin >> brr[i];
    priority_queue<long long int, vector<long long int>, greater<long long int>>
        pq;
    for (i = 0; i < n; i++) {
      pq.push(brr[i]);
      if (k < arr[i]) {
        while (!pq.empty() && k < arr[i]) {
          x = pq.top();
          pq.pop();
          k += temp;
          ans += x;
        }
      }
      if (k < arr[i]) {
        cout << "-1";
        return 0;
      }
    }
    cout << ans;
    cout << "\n";
  }
  return 0;
}
