#include <bits/stdc++.h>
using namespace std;
const int N = 10001;
long long *a1 = new long long[N];
long long *a2 = new long long[N];
int inVal[N], outVal[N];
void upd(int pos, long long val) { a2[pos] = min(a2[pos], val); }
int main() {
  int q, w, e, r, t, amount;
  scanf("%d %d", &q, &amount);
  for (w = 0; w < q; w++) {
    scanf("%d", &inVal[w]);
  }
  for (w = 0; w < q; w++) {
    scanf("%d", &outVal[w]);
  }
  for (w = 0; w <= q; w++) {
    a1[w] = 1e17;
  }
  a1[0] = 0;
  for (w = 0; w < q; w++) {
    for (e = 0; e <= q; e++) {
      a2[e] = 1e17;
    }
    for (e = 0; e < q; e++) {
      upd(e + 1, a1[e] + outVal[w]);
      upd(e, a1[e] + e * (long long)amount + inVal[w]);
    }
    swap(a1, a2);
  }
  long long ans = 1e17;
  for (w = 0; w <= q; w++) {
    ans = min(ans, a1[w]);
  }
  printf("%I64d", ans);
  return 0;
}
