#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 15;
int p[N], s[N];
long long dp[N], c;
int main() {
  int n, i, j;
  cin >> n >> c;
  for (i = 1; i <= n; ++i) scanf("%d", &p[i]);
  for (i = 1; i <= n; ++i) scanf("%d", &s[i]);
  dp[0] = 0;
  for (i = 1; i <= n; ++i) {
    dp[i] = 1e18;
    for (j = i; j >= 1; --j)
      dp[j] = min(dp[j] + c * j + p[i], dp[j - 1] + s[i]);
    dp[0] += p[i];
  }
  long long ret = 1e18;
  for (i = 0; i <= n; ++i) ret = min(ret, dp[i]);
  cout << ret << endl;
}
