#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, c;
  cin >> n >> c;
  vector<long long> p(n), s(n);
  for (long long &x : p) cin >> x;
  for (long long &x : s) cin >> x;
  vector<long long> next(n + 1),
      prev(n + 1, numeric_limits<long long>::max() / 2);
  prev[0] = 0;
  for (int i = 0; i < n; ++i) {
    next[0] = prev[0] + p[i];
    for (int j = 1; j <= n; ++j)
      next[j] = min(prev[j] + p[i] + (long long)j * c, prev[j - 1] + s[i]);
    swap(next, prev);
  }
  cout << *min_element(prev.begin(), prev.end()) << '\n';
  return 0;
}
