#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000009;
int main() {
  int n, i, j, k, m, t, h;
  cin >> n >> h;
  vector<int> d(n), s(n);
  for (i = 0; i < n; i++) cin >> d[i];
  for (i = 0; i < n; i++) cin >> s[i];
  set<int> best;
  int ans = 0;
  k = 0;
  for (i = 0; i < n; i++) {
    k += s[i];
    best.insert(s[i]);
    while (k < d[i]) {
      ans += h;
      k += *(--best.end());
    }
    k -= d[i];
    ans += d[i];
  }
  cout << ans << endl;
  return 0;
}
