#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 100;
int n;
long long c;
vector<long long> p;
vector<long long> s;
void read() {
  cin >> n >> c;
  p.resize(n);
  s.resize(n);
  for (long long& x : p) cin >> x;
  for (long long& x : s) cin >> x;
}
vector<long long> calcDp() {
  vector<long long> dp[2];
  dp[0].assign(n + 1, INF);
  dp[1].assign(n + 1, INF);
  dp[1][0] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= i; ++j) {
      dp[0][j] = dp[1][j] + j * c + p[i - 1];
      if (j != 0) dp[0][j] = min(dp[0][j], dp[1][j - 1] + s[i - 1]);
    }
    swap(dp[0], dp[1]);
  }
  return dp[1];
}
long long solve() {
  auto x = calcDp();
  return *min_element(x.begin(), x.end());
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  long long res = solve();
  cout << res << endl;
}
