#include <bits/stdc++.h>
const int _ = 1e4 + 5;
const long long INF = 1ll << 60;
inline long long min(long long a, long long b) { return a < b ? a : b; }
int n, c, s[_], t[_];
long long dp[2][_];
int main() {
  scanf("%d %d", &n, &c);
  for (int i = 1; i <= n; ++i) scanf("%d", s + i);
  for (int i = 1; i <= n; ++i) scanf("%d", t + i);
  for (int i = 1; i <= n; ++i) {
    memset(dp[i & 1], 0x3f, sizeof dp[i & 1]);
    dp[i & 1][0] = dp[(i - 1) & 1][0] + s[i];
    for (int j = 1; j <= i; ++j)
      dp[i & 1][j] = min(dp[(i - 1) & 1][j] + 1ll * c * j + s[i],
                         dp[(i - 1) & 1][j - 1] + t[i]);
  }
  long long ans = INF;
  for (int i = 0; i <= n; ++i) ans = min(ans, dp[n & 1][i]);
  printf("%lld\n", ans);
  return 0;
}
