#include <bits/stdc++.h>
using namespace std;
#define ldb long double
//#define base complex<ldb>
const int N=3005;
const ldb PI=acos(-1);
int T[N];
struct base
{
	ldb x,y;
	base(){ x=y=0;}
	base(ldb a, ldb b):x(a),y(b){}
	void operator += (base b){ x+=b.x;y+=b.y;}
	void operator /= (ldb b){ x/=b;y/=b;}
	ldb real(){ return x;}
	ldb imag(){ return y;}
};
int main()
{
	cout<<fixed<<setprecision(15);
    int n,L;
    scanf("%i %i",&n,&L);
	for(int i=1;i<=n;i++) scanf("%i",&T[i]);
	base sum(0,0);
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++)
	{
		ldb S=(ldb)(T[i]+T[j])/2;
		int ways=n-j+i-1;
		sum+=base(cos(2*PI*S/L)*ways,sin(2*PI*S/L)*ways);
		//printf("%i ",ways);
		//cout<<cos(2*PI*S/L)<<" "<<sin(2*PI*S/L)<<"\n";
		ways=j-i-1;
		sum+=base(cos(2*PI*S/L+PI)*ways,sin(2*PI*S/L+PI)*ways);
	}
	sum/=(ldb)n*(n-1)*(n-2)/6;
	cout<<sum.real()<<" "<<sum.imag()<<"\n";
	return 0;
}