#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int maxn = 10010;
const int INF = ~0U >> 1;
const double eps = 1e-9;
void getint(int &ret) {
  char ch;
  while (ch = getchar(), ch < '0' || ch > '9')
    ;
  ret = ch - '0';
  while (ch = getchar(), ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0';
}
long long f[maxn];
int n, k;
int p[maxn], s[maxn];
int main() {
  cin >> 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, 20, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j >= 1; j--) {
      f[j] = min(f[j - 1] + s[i], f[j] + 1ll * j * k + p[i]);
    }
    f[0] = f[0] + p[i];
  }
  long long ans = f[n];
  for (int i = 0; i <= n; i++)
    if (f[i] < ans) ans = f[i];
  cout << ans;
  return 0;
}
