#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
  std::fill((T*)array, (T*)(array + N), val);
}
template <typename T>
class segtree {
 private:
  int n, sz;
  vector<pair<T, int> > node;

 public:
  segtree(vector<T>& v) {
    sz = (int)v.size();
    n = 1;
    while (n < sz) {
      n *= 2;
    }
    node.resize(2 * n);
    for (int i = 0; i < (int)(sz); ++i) {
      node[i + n] = make_pair(v[i], i);
    }
    for (int i = n - 1; i >= 1; i--) {
      node[i] = min(node[2 * i], node[2 * i + 1]);
    }
  }
  void update(int k, T a) {
    node[k += n] = make_pair(a, k);
    while (k >>= 1) {
      node[k] = min(node[2 * k], node[2 * k + 1]);
    }
  }
  pair<T, int> query(int a, int b, int k = 0, int l = 0, int r = -1) {
    pair<T, int> res1 = make_pair((1LL << 60), -1);
    pair<T, int> res2 = make_pair((1LL << 60), -1);
    a += n, b += n;
    while (a != b) {
      if (a % 2) res1 = min(res1, node[a++]);
      if (b % 2) res2 = min(res2, node[--b]);
      a >>= 1, b >>= 1;
    }
    return min(res1, res2);
  }
  void print() {
    for (int i = 0; i < (int)(sz); ++i) {
      pair<T, int> p;
      p = query(i, i + 1);
      cout << "st[" << i << "]: " << p.first << " " << p.second << endl;
    }
  }
};
int n;
long long d;
long long saiki(segtree<long long>& sg, int a, int b) {
  if (b == a + 1) return 0;
  auto p = sg.query(a, b);
  long long s = p.first;
  long long ans = 0;
  int ind = p.second;
  if (ind - 1 >= a) {
    long long xx = sg.query(ind - 1, ind).first;
    ans += s + d + xx;
    sg.update(ind - 1, min(xx, s + d));
    ans += saiki(sg, a, ind);
  }
  if (ind + 1 < b) {
    long long xx = sg.query(ind + 1, ind + 2).first;
    ans += s + d + xx;
    sg.update(ind + 1, min(xx, s + d));
    ans += saiki(sg, ind + 1, b);
  }
  return ans;
}
int main() {
  cin >> n >> d;
  vector<long long> v(n + 1);
  for (int i = 0; i < (int)(n); ++i) cin >> v[i];
  segtree<long long> sg(v);
  long long ans = saiki(sg, 0, n);
  cout << ans << endl;
  return 0;
}
