#include <bits/stdc++.h>
using namespace std;
const int maxn = 10010;
const long long oo = 1e18;
long long c;
int n;
int p[maxn];
int s[maxn];
long long f[maxn];
void input() {
  scanf("%d%I64d", &n, &c);
  for (int i = (1), _b = (n); i <= _b; i++) scanf("%d", &p[i]);
  for (int i = (1), _b = (n); i <= _b; i++) scanf("%d", &s[i]);
}
void init() {}
void solve() {
  for (int i = (1), _b = (n); i <= _b; i++) {
    f[i] = oo;
    for (int j = (i), _a = (1); j >= _a; j--)
      f[j] = min(f[j] + p[i] + c * j, f[j - 1] + s[i]);
    f[0] += p[i];
  }
}
void output() {
  long long ans = 1e18;
  for (int i = (0), _b = (n); i <= _b; i++) ans = min(ans, f[i]);
  printf("%I64d", ans);
}
int main() {
  clock_t timestart, timeend;
  timestart = clock();
  input();
  init();
  solve();
  output();
  timeend = clock();
  return 0;
}
