#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, c;
  cin >> n >> c;
  long long p[n], s[n];
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> s[i];
  long long dp[2][n + 2];
  memset(dp, 0, sizeof(dp));
  int me = 0, other = 1;
  for (int i = 0; i < n; i++) {
    swap(me, other);
    for (int j = 0; j < i + 2; j++) dp[me][j] = 1e18;
    for (int j = 0; j < i + 1; j++) dp[me][j] = p[i] + dp[other][j] + c * j;
    for (int j = 0; j < i + 1; j++)
      dp[me][j + 1] = min(dp[me][j + 1], s[i] + dp[other][j]);
  }
  long long mx = 1e18;
  for (int i = 0; i < n + 1; i++) mx = min(mx, dp[me][i]);
  cout << mx << '\n';
  return 0;
}
