#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 10003;
vector<int> g[N];
long long a[N], b[N];
long long dp[3][N];
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, n, k, j;
  int t;
  t = 1;
  long long c;
  while (t--) {
    cin >> n >> c;
    for (i = 0; i < n; i++) cin >> b[n - i];
    for (i = 0; i < n; i++) cin >> a[n - i];
    dp[0][0] = 0;
    for (i = 1; 1 < n + 1 ? i < n + 1 : i > n + 1; 1 < n + 1 ? i += 1 : i -= 1)
      dp[0][i] = 1e15;
    for (i = 1; 1 < n + 1 ? i < n + 1 : i > n + 1;
         1 < n + 1 ? i += 1 : i -= 1) {
      dp[(i - 1) & 1][i] = 1e15;
      for (j = 0; 0 < i + 1 ? j < i + 1 : j > i + 1;
           0 < i + 1 ? j += 1 : j -= 1) {
        if (!j)
          dp[i & 1][j] = dp[(i - 1) & 1][j] + a[i];
        else
          dp[i & 1][j] = min(dp[(i - 1) & 1][j - 1] + b[i],
                             dp[(i - 1) & 1][j] + a[i] + c * j);
      }
    }
    long long ans = 1e15;
    for (i = 0; i < n + 1; i++) ans = min(ans, dp[n & 1][i]);
    cout << ans << endl;
  }
  return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long)result * base) % mod;
    base = ((long long)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
void ipgraph(int n, int m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
}
void dfs(int u, int par) {
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
  }
}
