#include <bits/stdc++.h>
using namespace std;
const int MAX = 10010;
const long long inf = 1e18;
int p[MAX], s[MAX];
long long f[MAX], nf[MAX];
int main(void) {
  int n, c;
  scanf("%d %d", &n, &c);
  for (int i = (0); i < (n); ++i) scanf("%d", &p[i]);
  for (int i = (0); i < (n); ++i) scanf("%d", &s[i]);
  f[0] = 0;
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (i + 2); ++j) nf[j] = inf;
    for (int j = (0); j < (i + 1); ++j) {
      nf[j] = min(nf[j], f[j] + j * 1LL * c + p[i]);
      nf[j + 1] = min(nf[j], f[j] + s[i]);
    }
    for (int j = (0); j < (i + 2); ++j) f[j] = nf[j];
  }
  long long ans = *min_element(f, f + n + 1);
  printf("%lld\n", ans);
  return 0;
}
