#include <bits/stdc++.h>
using std::max;
using std::min;
using std::swap;
using std::vector;
const long long N = 10005;
long long f[2][N];
long long n, c, p[N], s[N];
long long getint() {
  long long X = 0, w = 0;
  char ch = getchar();
  while (!isdigit(ch)) w |= ch == '-', ch = getchar();
  while (isdigit(ch)) X = X * 10 + ch - 48, ch = getchar();
  if (w) return -X;
  return X;
}
signed main() {
  n = getint(), c = getint();
  for (long long i = 1; i <= n; i++) p[i] = getint();
  for (long long i = 1; i <= n; i++) s[i] = getint();
  memset(f[0], 0x3f, sizeof f[0]);
  f[0][0] = 0;
  long long now = 0;
  for (long long i = 1; i <= n; i++) {
    now ^= 1;
    memset(f[now], 0x3f, sizeof f[now]);
    for (long long j = 0; j <= n; j++) {
      if (j) f[now][j] = min(f[now][j], f[now ^ 1][j - 1] + s[i]);
      f[now][j] = min(f[now][j], f[now ^ 1][j] + p[i] + j * c);
    }
  }
  long long ans = 2e18;
  for (long long i = 0; i <= n; i++) ans = min(ans, f[now][i]);
  printf("%lld\n", ans);
  return 0;
}
