#include <bits/stdc++.h>
using namespace std;
int q[1000100], t[1000100];
int d[1010], s[1010], ss[1010];
int main() {
  int n;
  int kk;
  cin >> n >> kk;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i];
    d[i] += d[i - 1];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    ss[i] = s[i];
    s[i] = max(s[i], s[i - 1]);
  }
  int k = 1;
  for (int i = 0; i <= d[n]; ++i)
    if (d[k - 1] == i) {
      int j = i;
      t[j] = t[j] + ss[k];
      while (j < d[k]) {
        if (t[j] > 0) {
          t[j + 1] = t[j] - 1;
          q[j + 1] = q[j] + 1;
        } else {
          t[j + 1] = s[k] - 1;
          q[j + 1] = q[j] + 1;
          q[j + 1] += kk;
        }
        j++;
      }
      k++;
    }
  cout << q[d[n]];
  return 0;
}
