#include <bits/stdc++.h>
using namespace std;
const int maxn = 10005;
long long f[2][maxn];
int p[maxn], s[maxn], n, c;
int main() {
  cin >> n >> c;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i <= n; i++) f[0][i] = f[1][i] = (1ll << 60);
  f[0][0] = 0;
  for (int i = 0; i < n; i++) {
    swap(f[0], f[1]);
    for (int j = 0; j <= i + 1; j++) {
      f[0][j] = f[1][j] + s[i];
      if (j) f[0][j] = min(f[0][j], f[1][j - 1] + p[i] + c * 1ll * (i - j + 1));
    }
  }
  long long ans = (1ll << 60);
  for (int i = 0; i <= n; i++) ans = min(ans, f[0][i]);
  cout << ans << endl;
  return 0;
}
