#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e16;
long long max(long long a, long long b) { return a > b ? a : b; };
long long min(long long a, long long b) { return a < b ? a : b; };
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; };
long long read() {
  char c = getchar();
  long long d = 0, f = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; d = d * 10 + c - 48, c = getchar())
    ;
  return d * f;
}
long long n, c, ans, a[10001], b[10001], f[10001];
int main() {
  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] = oo;
  for (int i = 1; i <= n; i++)
    for (int j = i - 1; j >= 0; j--) {
      f[j + 1] = min(f[j + 1], f[j] + b[i]);
      f[j] = f[j] + a[i] + j * c;
    }
  ans = oo;
  for (int i = 0; i <= n; i++) ans = min(ans, f[i]);
  cout << ans << endl;
}
