#TLE テスト

N, D = list(map(int,input().split()))
A = list(map(int, input().split()))

rt = (N-1) * D + A[N-1]
Ll = [N-1]
k = N - 2
for i in range(N - 2, 0, -1):
  t = (i - k) * D + A[i]
  if rt > t:
    Ll.append(i)
    k = i
    rt = A[i]
    
rt = (N - 1) * D + A[0]
Lr = [0]
k = 0
for i in range(1, N - 1):
  t = (k - i) * D + A[i]
  if rt > t:
    Lr.append(i)
    k = i
    rt = A[i]

Ch = [[0] * N for i in range(N)]
L = []
cnt = -1
for i in range(N-1):
  if i >= Ll[cnt]:
    cnt -= 1
  L.append((A[i] + A[Ll[cnt]] + (Ll[cnt] - i) * D, i, Ll[cnt]))
  Ch[i][Ll[cnt]] = 1

cnt = -1
for i in range(N-1, 0, -1):
  if i <= Lr[cnt]:
    cnt -= 1
  if Ch[Lr[cnt]][i] == 0:
  	L.append((A[i] + A[Lr[cnt]] + (i - Lr[cnt]) * D, Lr[cnt], i))
  
L.sort()