#include <bits/stdc++.h>
using namespace std;
long long dp[2][111111];
int main() {
  ios::sync_with_stdio(0);
  int n, c;
  cin >> n >> c;
  vector<int> p(n + 1), s(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
  }
  fill(dp[0], dp[2], 1e18);
  dp[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    fill(dp[i % 2], dp[i % 2 + 1], 1e18);
    dp[i % 2][0] = dp[i % 2 ^ 1][0] + p[i];
    for (int j = 1; j <= i; ++j) {
      dp[i % 2][j] = min(dp[i % 2 ^ 1][j - 1] + s[i],
                         dp[i % 2 ^ 1][j] + p[i] + 1LL * c * j);
    }
  }
  long long ans = dp[n % 2][0];
  for (int i = 1; i <= n; ++i) {
    ans = min(ans, dp[n % 2][i]);
  }
  cout << ans;
}
