#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define db double
using namespace std;
const int N=3005;
int n,t[N];
db x,y,z,l,h;
int main(){
	cin>>n>>l;
	fo(i,1,n)cin>>t[i];
	h=l;
	l=acos(-1)/l;
	fo(i,1,n)fo(j,i+1,n)
		x+=cos(l*(t[i]+t[j]))*(i-1+n-j)+cos(l*(t[i]+t[j]+h))*(j-i-1),
		y+=sin(l*(t[i]+t[j]))*(i-1+n-j)+sin(l*(t[i]+t[j]+h))*(j-i-1);
	z=(db)n*(n-1)*(n-2)/6;
	printf("%.10lf %.10lf\n",x/z,y/z);
}