#include <bits/stdc++.h>
using namespace std;
const int N = 10100;
int i, j, k, n, m, ch, c;
int s[N], t[N];
long long ans, f[N];
void R(int &x) {
  x = 0;
  ch = getchar();
  while (ch < '0' || '9' < ch) ch = getchar();
  while ('0' <= ch && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
}
void W(long long x) {
  if (x >= 10) W(x / 10);
  putchar(x % 10 + '0');
}
long long min(long long x, long long y) {
  if (x < y) return x;
  return y;
}
int main() {
  R(n);
  R(c);
  for (i = 1; i <= n; i++) R(s[i]);
  for (i = 1; i <= n; i++) R(t[i]);
  memset(f, 60, sizeof f);
  f[0] = 0;
  for (i = 1; i <= n; i++)
    for (j = i - 1; j >= 0; j--) {
      f[j + 1] = min(f[j + 1], f[j] + t[i]);
      f[j] = (long long)c * j + f[j] + s[i];
    }
  ans = 1000000000000000000ll;
  for (i = 0; i <= n; i++) ans = min(ans, f[i]);
  W(ans);
  puts("");
}
