#include<bits/stdc++.h>
using namespace std;

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 3007;
const double pi = acos(-1.00);

int n;
double loc[_],len;

int main()
{
	n=ty(),len=ty();
	for(int i=1;i<=n;i++)loc[i]=ty(),loc[i]=loc[i]*pi*2/len;

	sort(loc+1,loc+n+1);
	
	double sx=0,sy=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			double a=(loc[i]+loc[j])/2;
			sx+=cos(a)*(n-(j-i+1)),sy+=sin(a)*(n-(j-i+1));
			sx+=cos(a+pi)*(j-i-1),sy+=sin(a+pi)*(j-i-1);
		}
	}

	double all=1.00*n*(n-1)*(n-2)/6;
	printf("%.15lf %.15lf\n",sx/all,sy/all);

	return 0;
}
