#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, ans = 0;
  cin >> n >> k;
  long long int day[n], cost[n], plus;
  for (long long int i = 0; i < n; i++) {
    cin >> day[i];
  }
  cin >> plus;
  for (long long int i = 0; i < n; i++) {
    cin >> cost[i];
  }
  priority_queue<long long int, vector<long long int>, greater<long long int>>
      p;
  for (long long int i = 0; i < n; i++) {
    p.push(cost[i]);
    if (k < day[i]) {
      while (!p.empty() && k < day[i]) {
        k += plus;
        ans += p.top();
        p.pop();
      }
      if (k < day[i]) {
        ans = -1;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
