#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
int n, c, a[N], b[N];
long long dp[2][N];
int main() {
  scanf("%d%d", &n, &c);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  for (int i = n - 1; i >= 0; i--) {
    for (int cur = 0; cur <= i; cur++) {
      dp[i & 1][cur] = (long long)1e18;
      dp[(i & 1)][cur] =
          min(dp[(i & 1)][cur],
              (long long)a[i] + (long long)c * cur + dp[(i & 1) ^ 1][cur]);
      dp[(i & 1)][cur] = min(dp[(i & 1)][cur], b[i] + dp[(i & 1) ^ 1][cur + 1]);
    }
  }
  cout << dp[0][0] << endl;
  return 0;
}
