#include <bits/stdc++.h>
using namespace std;
const double PI=acos(-1);
const int Maxn=3005;
int a[Maxn];
int main(){
	int n,l;scanf("%d%d",&n,&l);
	double ansx=0,ansy=0;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			double o1=(a[i]+a[j])/2.0;
			ansx+=(n+i-j-1)*cos(2*PI*o1/l);
			ansy+=(n+i-j-1)*sin(2*PI*o1/l);
			double o2=(0ll+a[i]+a[j]+l)/2.0;
			ansx+=(j-i-1)*cos(2*PI*o2/l);
			ansy+=(j-i-1)*sin(2*PI*o2/l);
		}
	ansx/=1ll*n*(n-1)*(n-2)/6;
	ansy/=1ll*n*(n-1)*(n-2)/6;
	printf("%.15f %.15f",ansx,ansy);
	return 0;
}