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