## LTEテスト

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

Ll = [(A[i] + i * D, i) for i in range(1, N)]
Lr= [(A[i] + (N-i-1) * D, i) for i in range(0, N-1)]
Ll.sort()
Lr.sort()

L = []
CL = 0
CR = 0
for i in range(0, N-1):
  while Ll[CL][1] <= i:
    CL+=1
  L.append((A[i] + Ll[CL][0] - i * D, i, Ll[CL][1]))
  R = N-1-i
  while Lr[CR][1] >= R:
    CR+=1
  L.append((A[R] + Lr[CR][0] - i * D, Lr[CR][1], R))

L = list(set(L))
L.sort()