#include <bits/stdc++.h>
using namespace std;
int II() {
  int q;
  scanf("%d", &q);
  return q;
}
struct node {
  long long a, b;
  bool operator<(const node &seg) const { return b > seg.b; }
};
void solve() {
  long long N, K;
  cin >> N >> K;
  long long ar[N + 10], br[N + 10];
  for (long long i = 1; i <= N; i++) cin >> ar[i];
  long long C;
  cin >> C;
  for (long long i = 1; i <= N; i++) cin >> br[i];
  priority_queue<node> q;
  long long ans = 0;
  for (long long i = 1; i <= N; i++) {
    q.push({i, br[i]});
    if (K < ar[i]) {
      while (K < ar[i] && q.size() > 0) {
        ans += q.top().b;
        K += C;
        q.pop();
      }
      if (K < ar[i]) {
        cout << -1 << endl;
        return;
      }
    }
  }
  cout << ans << endl;
}
int32_t main() {
  long long tt;
  tt = 1;
  long long cas = 1;
  while (tt--) {
    solve();
  }
}
