#include<algorithm>
#include<cstdio>
#include<cmath>
#define mxn 1000010
#define ldb long double
using namespace std;
const double PI=acos(-1.0);
int n,L,sl,fh,t[mxn];
double d,ansx,ansy;
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
int main()
{
	n=rd();L=rd();
	for(int i=1;i<=n;++i) t[i]=rd();
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j)
		{
			d=1.0*(t[i]+t[j])/L/2;
			ansx+=cos(2*PI*d)*(i-1+n-j)+cos(2*PI*d+PI)*(j-i-1);
			ansy+=sin(2*PI*d)*(i-1+n-j)+sin(2*PI*d+PI)*(j-i-1);
		}
	printf("%.10lf %.10lf\n",ansx*6/n/(n-1)/(n-2),ansy*6/n/(n-1)/(n-2));
	return 0;
}