#include <bits/stdc++.h>
using namespace std;
const int maxn = 10001;
long long dp[maxn], c, p[maxn], s[maxn], n;
int main() {
  ios_base::sync_with_stdio(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];
  for (int i = 1; i <= n; i++) {
    dp[i] = 1e18;
    for (int j = i; j >= 1; j--)
      dp[j] = min(dp[j] + p[i] + c * j, dp[j - 1] + s[i]);
    dp[0] += p[i];
  }
  cout << *min_element(dp, dp + n + 1) << endl;
  return 0;
}
