import sys
from math import *
from itertools import *

input = sys.stdin.readline

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

pairN = factorial(N)/(factorial(N-2)*factorial(2))
tripleN = factorial(N)/(factorial(N-3)*factorial(3))

ans = [0,0]
for i0, i1 in combinations(range(N),2):
	t0, t1 = T[i0], T[i1]
	tn = (t0+t1)/2
	to = tn+(L/2.0)
	cn = (cos(2.0*pi*tn/L),sin(2.0*pi*tn/L))
	co = (cos(2.0*pi*to/L),sin(2.0*pi*to/L))

	onum = (i1-i0)-1
	nnum = N-2-onum
	ans[0] += (cn[0]*nnum + co[0]*onum)/tripleN
	ans[1] += (cn[1]*nnum + co[1]*onum)/tripleN

print(" ".join(map(str,ans)))