#include <bits/stdc++.h>
using namespace std;
int n;
long long dp[2][110000], c, s[110000], t[110000], Ans = 1e18;
int main() {
  scanf("%d%lld", &n, &c);
  for (int i = 1; i <= n; i++) scanf("%lld", &s[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &t[i]);
  for (int i = 1; i <= n; i++) dp[1][i] = 5e17;
  for (int i = 1; i <= n; i++) {
    dp[0][0] = dp[1][0] + s[i];
    for (int j = 1; j <= i; j++)
      dp[0][j] = min(dp[1][j - 1] + t[i], dp[1][j] + s[i] + c * j);
    for (int j = 0; j <= i; j++) dp[1][j] = dp[0][j];
  }
  for (int i = 0; i <= n; i++) Ans = min(Ans, dp[1][i]);
  printf("%lld\n", Ans);
  return 0;
}
