import math

N, L = map(int, input().split())
Alterc = []
Alters = []
T = [int(input()) for i in range(N)]

x, y = 0, 0

for i in range(N):
  Alteredc, Altereds = [], []
  for j in range(N):
    Alteredc.append(math.cos(math.pi*(T[i] + T[j])/L))
    Altereds.append(math.sin(math.pi*(T[i] + T[j])/L))
  Alterc.append(Alteredc)
  Alters.append(Altereds)
for i in range(N-2):
  for j in range(i+1, N-1):
    x += Alterc[i][j] * (N - 1 - j)
    y += Alters[i][j] * (N - 1 - j)
for i in range(2, N):
  for j in range(1, i):
    x += Alterc[i][j] * j
    y += Alters[i][j] * j
for i in range(N-2):
  for j in range(i+2, N):
    x -= Alterc[i][j] * (j - 1 - i)
    y -= Alters[i][j] * (j - 1 - i)
x *= 6
x /= N * (N - 1) * (N - 2)
y *= 6
y /= N * (N - 1) * (N - 2)
print(x, y)