#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000,100000000")
using namespace std;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
long long d[1111], s[1111], Max[1111];
int main(void) {
  long long n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    if (i == 1)
      Max[i] = s[i];
    else
      Max[i] = max(Max[i - 1], s[i]);
  }
  long long now = s[1], rez = 0;
  for (int i = 2; i <= n + 1; i++) {
    if (now < d[i - 1]) {
      long long x = 0;
      while (now + x < d[i - 1]) x += Max[i - 1];
      rez += (x / Max[i - 1]) * m + d[i - 1];
      now += x;
      now += s[i];
      now -= d[i - 1];
    } else {
      rez += d[i - 1];
      now -= d[i - 1];
      now += s[i];
    }
  }
  cout << rez << endl;
  return 0;
}
