#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = (int)(1e9 + 1337);
const long long LINF = (long long)(2e18);
const double EPS = 1e-11;
const int MAXN = 10010;
int n;
long long c;
int p[MAXN];
int s[MAXN];
long long d[MAXN];
void solve() {
  cin >> n >> c;
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; i < n; ++i) cin >> s[i];
  memset(d, 63, sizeof d);
  d[0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j >= 0; --j) {
      d[j + 1] = min(d[j + 1], d[j] + (i - j) * c + p[i]);
      d[j] = d[j] + s[i];
    }
  }
  long long ans = 1e18;
  for (int i = 0; i <= n; ++i) ans = min(ans, d[i]);
  cout << ans;
}
int main() {
  srand(1337);
  int ts = 1;
  for (int i = 0; i < ts; ++i) solve();
  return 0;
}
