#include <bits/stdc++.h>
using namespace std;
template <typename TP>
inline bool rd(TP& r) {
  r = 0;
  bool mns = 0;
  char tmp = getchar();
  while (tmp < '0' || tmp > '9') {
    if (tmp == '-') mns = 1;
    if (tmp == EOF) return 0;
    tmp = getchar();
  }
  while ('0' <= tmp && tmp <= '9') {
    r = (r << 3) + (r << 1) + tmp - '0';
    tmp = getchar();
  }
  if (mns) r = -r;
  return 1;
}
int n;
long long c;
long long p[10100], s[10100];
long long f[2][10100];
int main() {
  rd(n), rd(c);
  for (int i = 1; i <= n; ++i) rd(p[i]);
  for (int i = 1; i <= n; ++i) rd(s[i]);
  memset(f, 0x3f, sizeof(f));
  f[0][0] = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= i; ++j) {
      f[(i & 1)][j] = f[((i & 1) ^ 1)][j] + p[i] + j * c;
      if (j) f[(i & 1)][j] = min(f[(i & 1)][j], f[((i & 1) ^ 1)][j - 1] + s[i]);
    }
  long long ans = f[n & 1][0];
  for (int j = 1; j <= n; ++j)
    if (ans > f[n & 1][j]) ans = f[n & 1][j];
  cout << ans << endl;
  return 0;
}
