#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long double EPS = 1e-9;
const int N = 10000 + 7;
int p[N], s[N];
long long cut[2][N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, c;
  cin >> n >> c;
  int p[n], s[n];
  for (int i = 1; i <= n; ++i) cin >> p[i];
  for (int i = 1; i <= n; ++i) cin >> s[i];
  cut[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    int ii = (i & 1);
    for (int j = 0; j <= i; ++j) {
      long long temp = INF;
      if (j > 0) temp = min(temp, cut[1 - ii][j - 1] + s[i]);
      if (j < i) temp = min(temp, cut[1 - ii][j] + p[i] + c * j);
      cut[ii][j] = temp;
    }
  }
  long long sold = INF;
  for (int i = 0; i <= n; ++i) sold = min(sold, cut[n & 1][i]);
  cout << sold << "\n";
  return 0;
}
