#include <bits/stdc++.h>
using namespace std;
const int max_N = 1e4 + 10;
const long long inf = 1e15 + 10;
long long S[max_N], P[max_N];
long long dp[2][max_N];
int main() {
  int N;
  long long C;
  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 i = 1; i <= N; ++i) {
    dp[0][i] = inf;
  }
  int prev = 0;
  for (int i = 1; i <= N; ++i) {
    dp[prev ^ 1][0] = dp[prev][0] + (C * 0) + P[i];
    for (int j = 1; j <= N; ++j) {
      dp[prev ^ 1][j] =
          min(dp[prev][j] + (C * j) + P[i], dp[prev][j - 1] + S[i]);
    }
    prev ^= 1;
  }
  long long ans = inf;
  for (int i = 0; i <= N; ++i) {
    ans = min(ans, dp[prev][i]);
  }
  cout << ans << endl;
}
