#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  long long oo = numeric_limits<long long>::max();
  int n;
  long long c;
  cin >> n >> c;
  vector<long long> prod(n), sell(n);
  for (auto &i : prod) cin >> i;
  for (auto &i : sell) cin >> i;
  vector<long long> dp(n + 1, oo);
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    vector<long long> temp(n + 1, oo);
    for (int j = 0; j < n; j++) {
      if (i < j || dp[j] >= oo) continue;
      temp[j + 1] = min(temp[j + 1], dp[j] + sell[i]);
      temp[j] = min(temp[j], dp[j] + prod[i] + j * c);
    }
    swap(dp, temp);
  }
  long long ans = oo;
  for (auto &i : dp) ans = min(ans, i);
  cout << ans;
  return 0;
}
