#include <bits/stdc++.h>
const int N = 10010;
int n, k, p[N], s[N];
long long ans, f[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", p + i);
  for (int i = 1; i <= n; ++i) scanf("%d", s + i);
  memset(f, 60, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i; j >= 0; --j) {
      f[j] += p[i] + (long long)j * k;
      if (j) f[j] = std::min(f[j], f[j - 1] + s[i]);
    }
  ans = 1e18;
  for (int i = 0; i <= n; ++i) ans = std::min(ans, f[i]);
  printf("%I64d\n", ans);
  return 0;
}
