#include <bits/stdc++.h>
using namespace std;
int n;
long long T[2][10004], dp[2][10004], c, res = 1000000000000000000LL;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> c;
  for (int j = 0; j < 2; j++)
    for (int i = 1; i <= n; i++) cin >> T[j][i];
  for (int i = 1; i <= n; i++) {
    dp[i % 2][0] = dp[(i + 1) % 2][0] + T[0][i];
    for (int j = 1; j <= i; j++) {
      if (j < i)
        dp[i % 2][j] = min(dp[(i + 1) % 2][j - 1] + T[1][i],
                           dp[(i + 1) % 2][j] + T[0][i] + c * j);
      else
        dp[i % 2][j] = dp[(i + 1) % 2][j - 1] + T[1][i];
    }
  }
  for (int i = 0; i <= n; i++) res = min(res, dp[n % 2][i]);
  cout << res << '\n';
  return 0;
}
