#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long p[10005], s[10005];
long long f[2][10005];
int main() {
  memset(f, 127, sizeof f);
  int n;
  long long c;
  n = read();
  c = read();
  for (int i = 1; i <= n; i++) p[i] = read();
  for (int i = 1; i <= n; i++) s[i] = read();
  f[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      f[i & 1][j] = f[(i - 1) & 1][j] + p[i] + j * c;
      if (j) f[i & 1][j] = min(f[i & 1][j], f[(i - 1) & 1][j - 1] + s[i]);
    }
  }
  long long ans = f[n & 1][0];
  for (int i = 1; i <= n; i++) ans = min(ans, f[n & 1][i]);
  printf("%I64d\n", ans);
  return 0;
}
