## TLEテスト

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 = []
LC = 0
cnt = 0
while True:
  while Ll[cnt][1] > LC:
    L.append((A[LC] + Ll[cnt][0] - LC * D, LC, Ll[cnt][1]))
    LC += 1
  if LC == N-1:
    break
  while Ll[cnt][1] <= LC:
    cnt += 1

cnt = 0
RC = N-1
while True:
  while Lr[cnt][1] < RC:
    L.append((A[RC] + Lr[cnt][0] - (N - 1 - RC) * D, Lr[cnt][1], RC))
    RC -= 1
  if RC == 0:
    break
  while Lr[cnt][1] >= RC:
    cnt += 1

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