#include <bits/stdc++.h>
using namespace std;
long long dp[2][10005];
int p[10005], s[10005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, c;
  cin >> n >> c;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) cin >> s[i];
  memset(dp, -1, sizeof(dp));
  int pv = 0, nt = 1;
  dp[pv][0] = 0;
  for (int i = 1; i <= n; i++) {
    memset(dp[nt], -1, sizeof(dp[nt]));
    for (int j = 0; j <= i - 1; j++) {
      if (dp[pv][j] == -1) continue;
      int a = j, b = i - 1 - j;
      if (dp[nt][j + 1] == -1 || dp[nt][j + 1] > dp[pv][j] + s[i])
        dp[nt][j + 1] = dp[pv][j] + s[i];
      if (dp[nt][j] == -1 || dp[nt][j] > dp[pv][j] + c * 1ll * a + p[i])
        dp[nt][j] = dp[pv][j] + c * 1ll * a + p[i];
    }
    swap(pv, nt);
  }
  long long ans = 1e18;
  for (int j = 0; j <= n; j++) ans = min(ans, dp[pv][j]);
  printf("%lld\n", ans);
}
