#include <bits/stdc++.h>
using namespace std;
int N;
long long C, p[10005], s[10005], dp[10005], ans;
int main() {
  cin >> N >> C;
  for (int i = 0; i < N; i++) cin >> p[i];
  for (int i = 0; i < N; i++) cin >> s[i];
  for (int i = 0; i < N; i++) dp[i] = p[i] + dp[i - 1];
  ans = dp[N - 1];
  for (int j = 1; j <= N; j++) {
    for (int i = N - 1; i > 0; i--) dp[i] = dp[i - 1] + s[i];
    dp[0] = s[0];
    for (int i = 0; i < N; i++) dp[i] = min(dp[i], dp[i - 1] + p[i] + C * j);
    ans = min(ans, dp[N - 1]);
  }
  cout << ans << endl;
}
