#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1061109567;
const ll INF = 4557430888798830399;
const int MOD = 1e9 + 7;
int n, c;
ll dp[10005][2];
int s[10005], p[10005];
ll res = INF;
int main() {
  cin.tie(0)->sync_with_stdio(0);
  if (fopen(".in", "r")) {
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
  }
  cin >> n >> c;
  for (int i = 1; i <= n; ++i) cin >> p[i];
  for (int i = 1; i <= n; ++i) cin >> s[i];
  dp[0][0] = 0;
  for (int j = 0; j <= n; ++j)
    for (int i = max(j, 1); i <= n; ++i) {
      dp[i][j & 1] = dp[i - 1][j & 1] + (ll)j * c + p[i];
      if (j) dp[i][j & 1] = min(dp[i][j & 1], dp[i - 1][(j - 1) & 1] + s[i]);
      if (i == n) res = min(res, dp[n][j & 1]);
    }
  cout << res << "\n";
  return 0;
}
