#include <bits/stdc++.h>
using namespace std;
long long p[10001], s[10001];
long long dp[2][10002];
int main() {
  int n;
  long long c;
  scanf("%d %I64d", &n, &c);
  for (int i = 1; i <= n; i++) scanf("%I64d", &p[i]);
  for (int i = 1; i <= n; i++) scanf("%I64d", &s[i]);
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i % 2][0] = dp[(i - 1) % 2][0] + p[i];
    for (int j = 1; j < i; j++) {
      dp[i % 2][j] =
          min(dp[(i - 1) % 2][j - 1] + s[i], dp[(i - 1) % 2][j] + p[i] + j * c);
    }
    dp[i % 2][i] = dp[(i - 1) % 2][i - 1] + s[i];
  }
  long long ans = dp[n % 2][0];
  for (int i = 1; i <= n; i++) {
    ans = min(ans, dp[n % 2][i]);
  }
  printf("%I64d\n", ans);
  return 0;
}
