//---------- begin union_find ----------
#[allow(dead_code)]
mod union_find {
    pub struct UF {
        p: Vec<i32>,
    }
    impl UF {
        pub fn new(n: usize) -> UF {
            UF {p: vec![-1; n] }
        }
        pub fn init(&mut self) {
            for p in self.p.iter_mut() {
                *p = -1;
            }
        }
        pub fn root(&mut self, mut x: usize) -> usize {
            while self.p[x] >= 0 {
                x = self.p[x] as usize;
            }
            x
        }
        pub fn same(&mut self, x: usize, y: usize) -> bool {
            self.root(x) == self.root(y)
        }
        pub fn unite(&mut self, mut x: usize, mut y: usize) -> Option<(usize, usize)> {
            x = self.root(x);
            y = self.root(y);
            if x == y {
                return None;
            }
            if self.p[x] > self.p[y] {
                let s = x;
                x = y;
                y = s;
            }
            self.p[x] += self.p[y];
            self.p[y] = x as i32;
            Some((x, y))
        }
        pub fn get_size(&mut self, x: usize) -> usize {
            let r = self.root(x);
            (-self.p[r]) as usize
        }
    }
}
//---------- end union_find ----------
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let d: u64 = it.next().unwrap().parse().unwrap();
    let a: Vec<u64> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
    let mut e = vec![];
    let mut local = (a[0], 0);
    for i in 1..n {
        local.0 += d;
        e.push((local.1, i, local.0 + a[i]));
        if local.0 > a[i] {
            local = (a[i], i);
        }
    }
    let mut local = (a[n - 1], n - 1);
    for i in (0..(n - 1)).rev() {
        local.0 += d;
        e.push((i, local.1, local.0 + a[i]));
        if local.0 > a[i] {
            local = (a[i], i);
        }
    }
    e.sort_by_key(|e| e.2);
    let mut ans = 0;
    let mut u = union_find::UF::new(n);
    for (a, b, c) in e {
        if u.unite(a, b).is_some() {
            ans += c;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}
