#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
const long long INF = 1LL << 60;
int n, c;
long long ans;
int p[N], s[N];
long long f[N];
inline int in(int x = 0, char ch = getchar()) {
  while (ch > '9' || ch < '0') ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x;
}
int main() {
  n = in(), c = in();
  for (int i = 1; i <= n; i++) p[i] = in();
  for (int i = 1; i <= n; i++) s[i] = in();
  for (int i = 1; i <= n; i++) f[i] = INF;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j; j--)
      f[j] = min(f[j - 1] + s[i], f[j] + (long long)j * c + p[i]);
    f[0] += p[i];
  }
  ans = INF;
  for (int i = 0; i <= n; i++) ans = min(ans, f[i]);
  return cout << ans << endl, 0;
}
