#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-9;
const int N = 1e4 + 5;
int p[N], s[N];
long long dp[2][N];
int main() {
  int n, c;
  scanf("%d%d", &(n), &(c));
  for (int i = (1); i <= (int)(n); ++i) scanf("%d", &(p[i]));
  for (int i = (1); i <= (int)(n); ++i) scanf("%d", &(s[i]));
  for (int i = (0); i <= (int)(1); ++i)
    for (int j = (0); j <= (int)(N - 1); ++j) dp[i][j] = inf;
  dp[1][0] = 0;
  for (int i = (1); i <= (int)(n); ++i) {
    swap(dp[0], dp[1]);
    for (int j = (0); j <= (int)(i); ++j) {
      dp[1][j] = dp[0][j] + p[i] + 1LL * j * c;
      if (j) dp[1][j] = min(dp[1][j], dp[0][j - 1] + s[i]);
    }
  }
  long long ans = inf;
  for (int i = (0); i <= (int)(n); ++i) ans = min(ans, dp[1][i]);
  printf("%lld\n", ans);
  return 0;
}
