#include <bits/stdc++.h>
using namespace std;
const long long inf = (1ll << 60);
const int maxn = 10010;
long long dp[2][maxn], c;
int p[maxn], s[maxn];
int n, id;
int main() {
  scanf("%d%I64d", &n, &c);
  for (int i = 0; i < n; i++) scanf("%d", p + i);
  for (int i = 0; i < n; i++) scanf("%d", s + i);
  for (int i = 1; i <= n; i++) dp[0][i] = inf;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i + 1; j++) dp[id ^ 1][j] = inf;
    for (int j = 0; j <= i; j++) {
      dp[id ^ 1][j] = min(dp[id ^ 1][j], dp[id][j] + p[i] + c * j);
      dp[id ^ 1][j + 1] = min(dp[id ^ 1][j + 1], dp[id][j] + s[i]);
    }
    id ^= 1;
  }
  long long res = inf;
  for (int i = 0; i <= n; i++) res = min(res, dp[id][i]);
  cout << res << endl;
  return 0;
}
