#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int maxN = (int)1e4 + 100;
long long dp[maxN];
long long ndp[maxN];
long long p[maxN], s[maxN], c;
int n;
const long long INF = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  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 = 0; i <= n; i++) {
    dp[i] = INF;
    ndp[i] = INF;
  }
  dp[0] = 0;
  for (int i = 0; i + 1 <= n; i++) {
    for (int cnt = 0; cnt <= i; cnt++) {
      ndp[cnt] = min(ndp[cnt], dp[cnt] + c * cnt + p[i + 1]);
      ndp[cnt + 1] = min(ndp[cnt + 1], dp[cnt] + s[i + 1]);
    }
    for (int cnt = 0; cnt <= i + 1; cnt++) {
      dp[cnt] = ndp[cnt];
      ndp[cnt] = INF;
    }
  }
  long long mn = INF;
  for (int i = 0; i <= n; i++) mn = min(mn, dp[i]);
  cout << mn;
  return 0;
}
