#include <bits/stdc++.h>
using namespace std;
inline long long Max(const long long &a, const long long &b) {
  return a > b ? a : b;
}
inline long long Min(const long long &a, const long long &b) {
  return a > b ? b : a;
}
const long long INFll = (long long)1e18;
const int N = 1e4 + 7;
int n, c;
int p[N], s[N];
long long dp[2][N], ans;
int now;
int main() {
  cin >> n >> c;
  for (int i = 1; i <= n; ++i) cin >> p[i];
  for (int i = 1; i <= n; ++i) cin >> s[i];
  for (int i = 1; i <= n; ++i) {
    now ^= 1;
    for (int j = 0; j <= n; ++j) dp[now][j] = INFll;
    dp[now][0] = dp[now ^ 1][0] + p[i];
    for (int j = 1; j <= i; ++j) {
      dp[now][j] =
          Min(dp[now ^ 1][j] + p[i] + 1ll * j * c, dp[now ^ 1][j - 1] + s[i]);
    }
  }
  ans = INFll;
  for (int i = 0; i <= n; ++i) ans = Min(ans, dp[now][i]);
  cout << ans << endl;
  return 0;
}
