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