import math

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

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