#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 1;
const long long inf = 1e9 + 7;
signed main() {
  long long n, K;
  cin >> n >> K;
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  long long A;
  cin >> A;
  vector<long long> cost;
  for (long long i = 0; i < n; i++) {
    long long s;
    cin >> s;
    cost.push_back(s);
  }
  long long ans = 0;
  multiset<long long> st;
  long long mn = inf;
  for (long long i = 0; i < n; i++) {
    long long sv = mn;
    st.insert(cost[i]);
    while (!st.empty() && K < v[i]) {
      long long cur = *st.begin();
      st.erase(st.begin());
      K += A;
      ans += cur;
    }
    if (K < v[i]) return cout << -1, 0;
  }
  cout << ans;
}
