#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
long long s[maxn], v[maxn], dp[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k, ans = 0, a, flag = 0;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> s[i];
  cin >> a;
  for (int i = 1; i <= n; ++i) cin >> v[i];
  priority_queue<long long, vector<long long>, greater<long long>> p;
  for (int i = 1; i <= n; ++i) {
    p.push(v[i]);
    if (k < s[i]) {
      while (!p.empty() && k < s[i]) {
        k += a;
        ans += p.top();
        p.pop();
      }
      if (k < s[i]) flag = 1;
    }
    if (flag == 1) break;
  }
  if (flag)
    cout << -1;
  else
    cout << ans;
  return 0;
}
