#include <bits/stdc++.h>
using namespace std;
long long n, c, p[((long long)10 * 1001)], s[((long long)10 * 1001)],
    dp[2][((long long)10 * 1001)];
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n >> c;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++)
    cin >> s[i], dp[0][i] = dp[1][i] = ((long long)1e18);
  dp[1][0] = ((long long)1e18);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= i; j++)
      dp[(i & 1)][j] = min(j ? s[i] + dp[!(i & 1)][j - 1] : ((long long)1e18),
                           p[i] + dp[!(i & 1)][j] + c * j);
  for (int i = 1; i <= n; i++)
    dp[(n & 1)][i] = min(dp[(n & 1)][i], dp[(n & 1)][i - 1]);
  cout << dp[(n & 1)][n] << "\n";
  return 0;
}
