#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chkmin(T1 &first, T2 second) {
  if (first > second) first = second;
}
template <typename T1, typename T2>
inline void chkmax(T1 &first, T2 second) {
  if (first < second) first = second;
}
const string FILENAME = "input";
const int MAXN = 1e4;
int n, c;
int p[MAXN], d[MAXN];
long long func[MAXN + 1][2];
int main(int argc, char const *argv[]) {
  srand(time(0));
  cin >> n >> c;
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; i < n; ++i) cin >> d[i];
  for (int i = 1; i <= n; ++i) func[i][1] = 1e18;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= n; ++j) {
      func[j][0] = func[j][1];
      func[j][1] = 1e18;
    }
    for (int j = 0; j <= i; ++j) {
      chkmin(func[j + 1][1], func[j][0] + d[i]);
      chkmin(func[j][1], func[j][0] + (long long)c * j + p[i]);
    }
  }
  long long ans = 1e18;
  for (int i = 0; i <= n; ++i) {
    chkmin(ans, func[i][1]);
  }
  cout << ans << endl;
}
