#include<cstdio>
#include<cmath>
const double pi=acos(-1.0);
int n;
double a[3010],ansx,ansy,L;
int main(){
	scanf("%d%lf",&n,&L);
	for(int i=1;i<=n;i++)scanf("%lf",&a[i]);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			double A=(a[i]+a[j])/2,X=cos(2.0*pi*A/L),Y=sin(2.0*pi*A/L);
			ansx+=X*(n-2-(j-i-1)),ansy+=Y*(n-2-(j-i-1));
			X=-X,Y=-Y;
			ansx+=X*(j-i-1),ansy+=Y*(j-i-1);
		}
	double sum=1ll*n*(n-1)*(n-2)/6;
	printf("%.10lf %.10lf",ansx/sum,ansy/sum);
}