#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  while (t--) {
    long long int n, k, p, x, a[100009], i, ans = 0, b[100009], j;
    map<long long int, long long int> m;
    cin >> n >> p;
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    cin >> k;
    for (i = 1; i <= n; i++) {
      cin >> b[i];
      if (m[a[i]] == 0)
        m[a[i]] = x;
      else
        m[a[i]] = min(x, m[a[i]]);
    }
    priority_queue<long long int, vector<long long int>, greater<long long int>>
        q;
    for (i = 1; i <= n; i++) {
      if (p >= a[i])
        q.push(b[i]);
      else {
        q.push(b[i]);
        for (j = i + 1; j <= n; j++) {
          if (a[j] == a[i])
            q.push(b[j]);
          else
            break;
        }
        i = j - 1;
        while (!q.empty()) {
          if (p >= a[i]) break;
          auto t1 = q.top();
          q.pop();
          ans += t1;
          p = p + k;
        }
        if (q.empty() && p < a[i]) {
          cout << "-1";
          return 0;
        }
      }
    }
    cout << ans;
  }
}
