#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

bool chkmax(int &x,int y){return x<y?x=y,true:false;}
bool chkmin(int &x,int y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,l;
ll t[3005];
const ld pi=acos(-1);

int main(){
	n=readint(); l=readint();
	for(int i=1;i<=n;i++) t[i]=readint();
	sort(t+1,t+n+1);
	ld ansx=0,ansy=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			ll num=n-2-2*(j-i-1);
			ld alp=pi*(t[i]+t[j])/l;
			ansx+=cos(alp)*num,ansy+=sin(alp)*num;
		}
	}
	printf("%.15Lf %.15Lf\n",ansx*6/n/(n-1)/(n-2),ansy*6/n/(n-1)/(n-2));
	return 0;
}