#include <bits/stdc++.h>
using namespace std;
double TIME() { return (1.0 * clock()) / CLOCKS_PER_SEC; }
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long powerMod(long long x, long long y) {
  long long res = 1;
  x %= 998244353;
  while (y > 0) {
    if (y & 1) res = (res * x) % 998244353;
    y = y >> 1;
    x = (x * x) % 998244353;
  }
  return res % 998244353;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, m, a, i, j, k, l, p;
  cin >> n >> m;
  long long x[n], c[n];
  set<long long> s;
  map<long long, long long> mp;
  for (i = 0; i < n; i++) cin >> x[i];
  cin >> a;
  for (i = 0; i < n; i++) cin >> c[i];
  p = 0;
  for (i = 0; i < n; i++) {
    s.insert(c[i]);
    mp[c[i]]++;
    if (m < x[i]) {
      if (s.size() == 0) return cout << "-1\n", 0;
      while (s.size()) {
        auto it = s.begin();
        l = *it;
        if (mp[l] * a >= (x[i] - m)) {
          j = (x[i] - m + a - 1) / a;
          mp[l] -= j;
          if (mp[l] == 0) s.erase(it);
          p += l * j;
          m += j * a;
          break;
        } else {
          m += mp[l] * a;
          p += l * mp[l];
          mp[l] = 0;
          s.erase(it);
        }
      }
      if (m < x[i]) return cout << "-1\n", 0;
    }
  }
  cout << p << "\n";
  return 0;
}
