#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod = (1000000007LL)) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
int n;
long long cap, prod[10005], sold[10004], DP[2][10005];
int main() {
  scanf("%d%lld", &n, &cap);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &prod[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &sold[i]);
  }
  DP[1][0] = prod[1];
  DP[1][1] = sold[1];
  for (int i = 2; i <= n; i++) {
    int curr = i & 1;
    int prev = 1 - curr;
    for (int j = 0; j <= i; j++) {
      DP[curr][j] = (long long)1e15;
      if (j != 0) {
        DP[curr][j] = min(DP[curr][j], DP[prev][j - 1] + sold[i]);
      }
      if (j != i) {
        DP[curr][j] = min(DP[curr][j], DP[prev][j] + prod[i] + j * cap);
      }
    }
  }
  long long ans = (long long)1e15;
  for (int j = 0; j <= n; j++) ans = min(ans, DP[n & 1][j]);
  printf("%lld", ans);
  return 0;
}
