#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 11000;
long long n, c;
long long p[MAXN], s[MAXN];
long long tmp[MAXN], dp[MAXN];
signed main() {
  scanf("%lld %lld", &n, &c);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &p[i]);
  }
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &s[i]);
  }
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  for (long long i = 1; i <= n; i++) {
    tmp[0] = dp[0] + p[i];
    for (long long j = 1; j < i; j++)
      tmp[j] = min(dp[j] + p[i] + j * c, dp[j - 1] + s[i]);
    tmp[i] = dp[i - 1] + s[i];
    memcpy(dp, tmp, sizeof(dp));
  }
  long long ans = 0x3f3f3f3f3f3f3f3f;
  for (long long i = 0; i <= n; i++) {
    ans = min(ans, dp[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
