#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 30, Mod = 1e9 + 7;
const long long SQ = 330;
long long a[N], c[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long A;
  cin >> A;
  for (int i = 1; i <= n; i++) cin >> c[i];
  multiset<long long> s;
  long long cur = k;
  for (int i = 1; i <= n; i++) {
    cur += A;
    if (cur < a[i]) return cout << -1, 0;
  }
  long long ans = 0;
  cur = k;
  for (int i = 1; i <= n; i++) {
    s.insert(c[i]);
    while (cur < a[i]) {
      long long v = *s.begin();
      ans += v;
      s.erase(s.find(v));
      cur += A;
    }
  }
  cout << ans;
  return (0);
}
