#include <bits/stdc++.h>
using namespace std;
const long long INFTY = 1LL << 60;
const int MAXN = 10005;
int N, C;
int P[MAXN];
int S[MAXN];
long long prevdp[MAXN];
long long curdp[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> C;
  for (int i = 1; i <= N; i++) cin >> P[i];
  for (int i = 1; i <= N; i++) cin >> S[i];
  for (int i = 1; i <= N; i++) prevdp[i] = INFTY;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= i; j++) {
      curdp[j] = INFTY;
      if (j < i) curdp[j] = prevdp[j] + (long long)j * C + P[i];
      if (j > 0) curdp[j] = min(curdp[j], prevdp[j - 1] + S[i]);
    }
    memcpy(prevdp, curdp, sizeof(curdp));
  }
  long long best = INFTY;
  for (int i = 0; i <= N; i++) best = min(best, curdp[i]);
  cout << best << "\n";
  return 0;
}
