#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
long long dp[2][10135];
int p[10135], s[10135];
void fmain() {
  scanf("%d%d", &n, &k);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", p + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", s + i);
  int t = 0;
  for (int(i) = 0; (i) < (int)(2); (i)++)
    for (int(j) = 0; (j) < (int)(10135); (j)++) dp[i][j] = (1LL << 60);
  dp[0][0] = 0;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    int pre = t, cur = t ^ 1;
    for (int(j) = 0; (j) < (int)(10135); (j)++) dp[cur][j] = (1LL << 60);
    for (int j = 0; j <= i; j++) {
      if (j) dp[cur][j] = min(dp[pre][j - 1] + s[i], dp[cur][j]);
      dp[cur][j] = min(dp[pre][j] + p[i] + (long long)k * j, dp[cur][j]);
    }
    t ^= 1;
  }
  long long ans = (1LL << 60);
  for (int(j) = 0; (j) < (int)(n + 1); (j)++) ans = min(dp[t][j], ans);
  printf("%lld\n", ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain();
  }
  return 0;
}
