#include <bits/stdc++.h>
using namespace std;
const int maxn = 10004;
long long S[maxn], P[maxn], dp[2][maxn];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int N;
  long long C;
  cin >> N >> C;
  for (int i = 1; i <= N; i++) cin >> S[i];
  for (int i = 1; i <= N; i++) cin >> P[i];
  dp[0][0] = 0;
  for (int i = 1; i <= N; i++) dp[0][i] = 1ll << 60;
  for (int i = 1; i <= N; i++) {
    int act = i % 2, ant = (i + 1) % 2;
    dp[act][0] = dp[ant][0] + S[i];
    for (int j = 1; j <= N; j++) {
      if (j > i)
        dp[act][j] = 1ll << 60;
      else
        dp[act][j] =
            min(dp[ant][j - 1] + P[i], dp[ant][j] + S[i] + (long long)j * C);
    }
  }
  long long sol = 1ll << 60;
  for (int i = 0; i <= N; i++) sol = min(sol, dp[N % 2][i]);
  cout << sol << '\n';
  return 0;
}
