#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 3000
#define DB double
using namespace std;
int n,l,a[N+5];const DB pi=acos(-1);
struct Point
{
	DB x,y;I Point() {x=y=0;}I Point(Con DB& a):x(cos(2*pi*a/l)),y(sin(2*pi*a/l)){}
	I Point(Con DB& a,Con DB& b):x(a),y(b){}
	I Point operator + (Con Point& t) Con {return Point(x+t.x,y+t.y);}
	I Point operator * (Con DB& t) Con {return Point(x*t,y*t);}
}ans;
int main()
{
	RI i,j;for(scanf("%d%d",&n,&l),i=1;i<=n;++i) scanf("%d",a+i);
	for(sort(a+1,a+n+1),i=1;i<=n;++i) for(j=i+1;j<=n;++j)
		ans=ans+Point((a[i]+a[j])/2.0)*(1.0*(n-2-(j-i-1)*2)/(n-2));
	return ans=ans*(6.0/n/(n-1)),printf("%.10lf %.10lf",ans.x,ans.y),0;
}