#include <bits/stdc++.h>
using namespace std;
const int maxn = 10001;
int n, c;
long long p[maxn], s[maxn], f[maxn];
int main() {
  scanf("%d %d", &n, &c);
  for (int i = 0; i < n; ++i) scanf("%I64d", &p[i]);
  for (int i = 0; i < n; ++i) scanf("%I64d", &s[i]);
  for (int i = 0; i < n; ++i) {
    f[i + 1] = LLONG_MAX >> 1;
    for (int j = i + 1; j; --j)
      f[j] = min(f[j - 1] + s[i], f[j] + 1ll * j * c + p[i]);
    f[0] += p[i];
  }
  long long ans = LLONG_MAX;
  for (int i = 0; i <= n; ++i) ans = min(ans, f[i]);
  printf("%I64d\n", ans);
  return 0;
}
