#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e4 + 5;
int p[MAXN], s[MAXN];
long long f[2][MAXN];
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
int main() {
  int n = read(), c = read();
  for (int i = 1; i <= n; i++) p[i] = read();
  for (int i = 1; i <= n; i++) s[i] = read();
  for (int i = 1; i <= n; i++) {
    int now = i & 1, pre = now ^ 1;
    memset(f[now], 0x3f, sizeof(f[now]));
    f[now][0] = f[pre][0] + p[i];
    for (int j = 1; j <= i; j++)
      f[now][j] = min(f[pre][j] + p[i] + 1ll * c * j, f[pre][j - 1] + s[i]);
  }
  long long ans = LLONG_MAX;
  for (int i = 0; i <= n; i++) ans = min(ans, f[n & 1][i]);
  cout << ans << endl;
  return 0;
}
