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