#include <bits/stdc++.h>
using namespace std;
const int dx[9] = {0, 1, -1, 0, 0, -1, -1, 1, 1};
const int dy[9] = {0, 0, 0, -1, 1, -1, 1, -1, 1};
const double pi = acos(-1.0);
const int N = 1e4 + 100;
long long f[2][N], p[N], s[N], c;
int n, now, pre;
int main() {
  ios::sync_with_stdio(false), 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++) {
    now = now ^ 1;
    f[now][0] = f[now ^ 1][0] + p[i];
    for (int j = 1; j <= i - 1; j++)
      f[now][j] = min(f[now ^ 1][j - 1] + s[i], f[now ^ 1][j] + p[i] + j * c);
    f[now][i] = f[now ^ 1][i - 1] + s[i];
  }
  long long ans = f[now][0];
  for (int i = 1; i <= n; i++) ans = min(ans, f[now][i]);
  cout << ans << endl;
  return 0;
}
