##TLE確認

def getR(x):
  if T[x] == x:
    return x
  return getR(T[x])
 
def judT(x, y):
  xR = getR(x)
  yR = getR(y)
  if xR != yR:
    T[xR] = yR
  return xR != yR
 
N, D = list(map(int,input().split()))
A = list(map(int, input().split()))
 
L = [((j-i) * D + A[i] + A[j], i, j) for i in range(N) for j in range(i+1, N)]
 
L.sort()
 
T = [i for i in range(N)]
 
C = 0
A = 0
 
print(A)