#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long test, n, m, root, k, x, y, z, l, r, ans, a[N], b[N];
void solve() {
  bool ok = 1;
  multiset<long long> s;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  cin >> k;
  for (long long i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1, j = 1; i <= n; i++) {
    s.insert(b[i]);
    while (s.size() && m < a[i]) ans += *s.begin(), s.erase(s.begin()), m += k;
    if (m < a[i]) {
      cout << -1;
      return;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
