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