#include <bits/stdc++.h>
using namespace std;
const int64_t INF = 1e17;
int main() {
  int64_t N, C;
  cin >> N >> C;
  vector<int64_t> P(N), S(N);
  for (int64_t &p : P) {
    cin >> p;
  }
  for (int64_t &s : S) {
    cin >> s;
  }
  vector<int64_t> F(N + 1);
  F[0] = P[0];
  F[1] = S[0];
  for (int i = 2; i <= N; ++i) {
    F[i] = INF;
  }
  int64_t ans = INF;
  for (int i = 1; i < N; ++i) {
    for (int j = N; j >= 0; --j) {
      F[j] = min(F[j] + P[i] + j * C, F[j - 1] + S[i]);
      if (i == N - 1) {
        ans = min(ans, F[j]);
      }
    }
  }
  cout << ans << endl;
}
