#include <bits/stdc++.h>
using namespace std;
const int maxn = 10005;
int n, c;
int p[maxn], s[maxn];
long long dp[2][maxn];
long long res;
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++) {
    int i1 = i & 1, i0 = i1 ^ 1;
    for (int j = 0; j <= i; j++) {
      dp[i1][j] = 1ll << 60;
      if (j) dp[i1][j] = min(dp[i0][j - 1] + s[i], dp[i1][j]);
      if (j < i) dp[i1][j] = min(dp[i0][j] + 1ll * j * c + p[i], dp[i1][j]);
    }
  }
  res = 1ll << 60;
  for (int j = 0; j <= n; j++) res = min(dp[n & 1][j], res);
  printf("%I64d\n", res);
  return 0;
}
