#include <bits/stdc++.h>
using namespace std;
int m, k, s[1005], d[1005], t, r, sum = 0, u, e, ans[1005], f;
int main() {
  t = 1;
  for (int i = 1; i <= t; i++) {
    sum = 0;
    r = 0;
    cin >> m >> k;
    for (int j = 1; j <= m; j++) {
      cin >> d[j];
    }
    for (int j = 1; j <= m; j++) {
      cin >> s[j];
    }
    for (int j = 2; j <= m + 1; j++) {
      for (int y = 1; y < j; y++) {
        if (s[y] > sum) {
          sum = s[y];
          f = y;
        }
      }
      if (d[j - 1] > s[j - 1] + r) {
        u = d[j - 1] - s[j - 1] - r;
        if (u % s[f] == 0) {
          r = 0;
          ans[j] = (u / s[f] * k) + ans[j - 1] + d[j - 1];
        } else {
          e = u / s[f];
          r = (e + 1) * s[f] - u;
          ans[j] = ((e + 1) * k) + ans[j - 1] + d[j - 1];
        }
      } else {
        ans[j] = ans[j - 1] + d[j - 1];
        r = s[j - 1] + r - d[j - 1];
      }
    }
    cout << ans[m + 1] << endl;
  }
  return 0;
}
