#include <bits/stdc++.h>
using namespace std;
int n, c;
int p[10005];
int s[10005];
long long dp[2][10005];
int main() {
  scanf("%d%d", &n, &c);
  for (int i = 1; i <= n; i++) scanf("%d", p + i);
  for (int i = 1; i <= n; i++) scanf("%d", s + i);
  memset(dp[0], 63, sizeof dp[0]);
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    memset(dp[i & 1], 63, sizeof dp[i & 1]);
    for (int j = 0; j <= i; j++) {
      dp[i & 1][j] = dp[i & 1 ^ 1][j] + j * 1ll * c + p[i];
      if (j) dp[i & 1][j] = min(dp[i & 1][j], dp[i & 1 ^ 1][j - 1] + s[i]);
    }
  }
  cout << *min_element(dp[n & 1], dp[n & 1] + n + 1);
  return 0;
}
