#include <bits/stdc++.h>
using namespace std;
void ga(int N, int *A) {
  for (int i(0); i < N; i++) scanf("%d", A + i);
}
int N, S[(10006)], P[(10006)], x;
long long dp[2][(10006)], X = 1e18, C;
int main(void) {
  scanf("%d%lld", &N, &C), ga(N, P + 1), ga(N, S + 1);
  **dp = P[1], dp[0][1] = S[1];
  for (int k(2); k < N + 1; k++) {
    x = !x, *dp[x] = *dp[!x] + P[k];
    for (int j(0); j < k - 1; j++)
      dp[x][j + 1] = min(dp[!x][j] + S[k], dp[!x][j + 1] + P[k] + (j + 1) * C);
    dp[x][k] = dp[!x][k - 1] + S[k];
  }
  for (int i(0); i < N + 1; i++) X = min(X, dp[x][i]);
  printf("%lld\n", X);
  return 0;
}
