#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void Min(T &a, T b) {
  if (b < a) a = b;
}
const int N = (int)1e4 + 5;
int in[N], out[N];
long long dp[2][N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = (1), _t = (n + 1); i < _t; ++i) scanf("%d", &in[i]);
  for (int i = (1), _t = (n + 1); i < _t; ++i) scanf("%d", &out[i]);
  bool cur = 0, pre = 1;
  for (int i = (1), _t = (n + 1); i < _t; ++i) {
    for (int j = (0), _t = (i + 1); j < _t; ++j) {
      dp[cur][j] = LLONG_MAX;
      if (j < i) Min(dp[cur][j], dp[pre][j] + in[i] + (long long)j * m);
      if (j) Min(dp[cur][j], dp[pre][j - 1] + out[i]);
    }
    cur ^= 1, pre ^= 1;
  }
  long long ans = LLONG_MAX;
  for (int i = (0), _t = (n + 1); i < _t; ++i) Min(ans, dp[pre][i]);
  cout << ans << endl;
  return 0;
}
