#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, d[1005], s[1005], mx, p = 0, r = 0;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> d[i];
  for (i = 1; i <= n; i++) cin >> s[i];
  for (i = 1; i <= n; i++) {
    r += s[i] - d[i];
    p += d[i];
    if (i == 1 || mx < s[i]) mx = s[i];
    while (r < 0) p += k, r += mx;
  }
  cout << p;
  return 0;
}
