#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
void solve(int n) {
  int c;
  cin >> c;
  vector<int> 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 + 1];
  memset(dp, 0, sizeof dp);
  int cur = 0;
  dp[cur][0] = 0;
  for (int i = 1; i <= n; i++) dp[cur][i] = inf;
  for (int i = 1; i <= n; i++) {
    int prev = cur;
    cur ^= 1;
    for (int j = 0; j <= n; j++) dp[cur][j] = inf;
    for (int j = 0; j < i; j++) {
      dp[cur][j + 1] = min(dp[cur][j + 1], dp[prev][j] + s[i - 1]);
      dp[cur][j] = min(dp[cur][j], dp[prev][j] + p[i - 1] + (long long)c * j);
    }
  }
  long long ans = inf;
  for (int i = 0; i <= n; i++) {
    ans = min(ans, dp[cur][i]);
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  while (cin >> n) solve(n);
}
