#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int w = 0, x = 0;
  char c = getchar();
  while (!isdigit(c)) w |= c == '-', c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  return w ? -x : x;
}
namespace star {
const int maxn = 1e4 + 10;
int n, c, a[maxn], b[maxn];
long long f[maxn];
inline void work() {
  n = read(), c = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) b[i] = read();
  for (int i = 1; i <= n; i++) {
    f[i] = f[i - 1] + b[i];
    for (int j = i - 1; j; j--)
      f[j] = min(f[j - 1] + b[i], f[j] + a[i] + 1ll * j * c);
    f[0] = f[0] + a[i];
  }
  long long ans = f[0];
  for (int i = 1; i <= n; i++) ans = min(ans, f[i]);
  printf("%lld\n", ans);
}
}  // namespace star
signed main() {
  star::work();
  return 0;
}
