#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int N = 1e4 + 10;
int a[N], b[N];
long long _d[2][N], *d = _d[0], *e = _d[1];
int main() {
  int n;
  long long c;
  scanf("%d%lld", &n, &c);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  for (int i = 0; i < n; ++i) scanf("%d", b + i);
  d[0] = a[0];
  d[1] = b[0];
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= i; ++j) {
      e[j] = d[j] + j * c + a[i];
      if (j > 0) e[j] = min(e[j], d[j - 1] + b[i]);
    }
    e[i + 1] = d[i] + b[i];
    swap(d, e);
  }
  long long ret = 1LL << 60;
  for (int j = 0; j <= n; ++j) {
    ret = min(ret, d[j]);
  }
  printf("%I64d\n", ret);
  return 0;
}
