#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
long long int p[N], s[N], n, c;
long long int dp[2][N];
int main() {
  cin >> n >> c;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> s[i];
  dp[0][0] = p[0];
  dp[0][1] = s[0];
  int row = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= i + 1; j++) {
      dp[row][j] = (long long)(1e18);
      if (j != i + 1) dp[row][j] = dp[1 - row][j] + j * c + p[i];
      if (j != 0) dp[row][j] = min(dp[row][j], dp[1 - row][j - 1] + s[i]);
    }
    row = 1 - row;
  }
  row = 1 - row;
  long long ansa = (long long)(1e18);
  for (int j = 0; j <= n; j++) ansa = min(ansa, dp[row][j]);
  cout << ansa << endl;
  return 0;
}
