#include <bits/stdc++.h>
namespace pb_ds {
namespace io {
const int MaxBuff = 1 << 15;
const int Output = 1 << 23;
char B[MaxBuff], *S = B, *T = B;
char Out[Output], *iter = Out;
inline void flush() {
  fwrite(Out, 1, iter - Out, stdout);
  iter = Out;
}
}  // namespace io
template <class Type>
inline Type Read() {
  using namespace io;
  register char ch;
  register Type ans = 0;
  register bool neg = 0;
  while (ch = ((S == T) && (T = (S = B) + fread(B, 1, MaxBuff, stdin), S == T)
                   ? 0
                   : *S++),
         (ch < '0' || ch > '9') && ch != '-')
    ;
  ch == '-' ? neg = 1 : ans = ch - '0';
  while (ch = ((S == T) && (T = (S = B) + fread(B, 1, MaxBuff, stdin), S == T)
                   ? 0
                   : *S++),
         '0' <= ch && ch <= '9')
    ans = ans * 10 + ch - '0';
  return neg ? -ans : ans;
}
template <class Type>
inline void Print(register Type x, register char ch = '\n') {
  using namespace io;
  if (!x)
    *iter++ = '0';
  else {
    if (x < 0) *iter++ = '-', x = -x;
    static int s[100];
    register int t = 0;
    while (x) s[++t] = x % 10, x /= 10;
    while (t) *iter++ = '0' + s[t--];
  }
  *iter++ = ch;
}
}  // namespace pb_ds
using namespace pb_ds;
using namespace std;
const int N = 1e4 + 5;
const long long inf = 1e18;
int n, c, now;
int p[N], s[N];
long long dp[2][N];
int main() {
  n = Read<int>(), c = Read<int>();
  for (int i = 1; i <= n; ++i) p[i] = Read<int>();
  for (int i = 1; i <= n; ++i) s[i] = Read<int>();
  for (int i = 1; i <= n; ++i) {
    now ^= 1;
    for (int j = 0; j <= i; ++j) dp[now][j] = inf;
    for (int j = 0; j < i; ++j) {
      if (dp[now ^ 1][j] == inf) continue;
      dp[now][j + 1] = min(dp[now][j + 1], dp[now ^ 1][j] + s[i]);
      dp[now][j] = min(dp[now][j], dp[now ^ 1][j] + p[i] + 1ll * j * c);
    }
  }
  long long ans = inf;
  for (int i = 0; i <= n; ++i) ans = min(ans, dp[now][i]);
  printf("%lld\n", ans);
  return 0;
}
