#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, flag = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flag = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
  return x * flag;
}
int n, c, p[10010], s[10010];
long long dp[10010];
int main() {
  n = read(), c = read();
  for (int i = 1; i <= n; i++) p[i] = read();
  for (int i = 1; i <= n; i++) s[i] = read();
  for (int i = 1; i <= n; i++) {
    dp[i] = 1e18;
    for (int j = i; j > 0; j--)
      dp[j] = min(dp[j] + (long long)j * (long long)c + (long long)p[i],
                  dp[j - 1] + (long long)s[i]);
    dp[0] += (long long)p[i];
  }
  long long ans = 1e18;
  for (int i = 0; i <= n; i++) ans = min(ans, dp[i]);
  cout << ans;
  return 0;
}
