#include <bits/stdc++.h>
using namespace std;
const long long maxn = 10005, mod = 20101009;
long long n, c, s[maxn], p[maxn], dp[2][maxn];
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
inline void write(long long a) {
  if (a < 0) {
    putchar('-');
    putchar('1');
  } else {
    if (a >= 10) write(a / 10);
    putchar(a % 10 + '0');
  }
}
signed main() {
  n = read(), c = read();
  for (long long i = 1; i <= n; ++i) p[i] = read();
  for (long long i = 1; i <= n; ++i) s[i] = read();
  dp[0][0] = 0;
  for (long long i = 1; i <= n; ++i) {
    memset(dp[i & 1], 0x3f, sizeof(dp[i & 1]));
    ;
    dp[i & 1][0] = dp[(i - 1) & 1][0] + p[i];
    for (long long j = 1; j <= i - 1; ++j)
      dp[i & 1][j] =
          min(dp[(i - 1) & 1][j - 1] + s[i], dp[(i - 1) & 1][j] + p[i] + j * c);
    dp[i & 1][i] = dp[(i - 1) & 1][i - 1] + s[i];
  }
  write(*min_element(dp[n & 1], dp[n & 1] + n + 1));
  return 0;
}
