#include <bits/stdc++.h>
using namespace std;
signed main() {
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, cur;
  cin >> n >> cur;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long cf;
  cin >> cf;
  vector<long long> b(n);
  for (long long i = 0; i < n; ++i) cin >> b[i];
  set<long long> st;
  long long res = 0;
  for (long long i = 0; i < n; ++i) {
    st.insert(b[i]);
    while (st.size() > 0 && cur < a[i]) {
      cur += cf;
      res += *st.begin();
      st.erase(st.begin());
    }
    if (st.size() == 0 && cur < a[i]) {
      cout << -1;
      return 0;
    }
  }
  cout << res;
  return 0;
}
