from math import sin, cos, pi

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

x, y = 0, 0

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