#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
#define N 3005
const double PI=acos(-1.0);
typedef long long ll;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,L,t[N];
double X,Y;
int main(){
	n=read(),L=read();
	for(int i=1;i<=n;++i){
		t[i]=read();
	}
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n;++j){
			X+=(n-2*(j-i))*cos(PI*(t[i]+t[j])/L);
			Y+=(n-2*(j-i))*sin(PI*(t[i]+t[j])/L);
		}
	}
	ll all=1LL*n*(n-1)*(n-2)/6;
	printf("%.12lf %.12lf\n",X/all,Y/all);
	return 0;
}

