#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 5;
long long dp[2][maxn];
int n, c, p[maxn], s[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if (fopen("A"
            ".INP",
            "r")) {
    freopen(
        "A"
        ".INP",
        "r", stdin);
    freopen(
        "A"
        ".OUT",
        "w", stdout);
  }
  cin >> n >> c;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
  }
  fill_n(&dp[0][0], maxn * 2, 1e18);
  int bit = 0;
  dp[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    bit ^= 1;
    dp[bit][0] = dp[!bit][0] + p[i];
    for (int j = 1; j <= i; ++j) {
      dp[bit][j] = min(dp[!bit][j - 1] + s[i],
                       dp[!bit][j] + (long long)p[i] + (long long)j * c);
    }
  }
  long long res = 1e18;
  for (int i = 0; i <= n; ++i) res = min(res, dp[bit][i]);
  cout << res;
}
