#include<bits/stdc++.h>
using namespace std;

const int N=3010;
double T[N],L;
int n;
double Pi=acos(-1.0)*2;

int main(){
	scanf("%d %lf",&n,&L);L*=2;
	for(int i=1;i<=n;i++) scanf("%lf",&T[i]);
	double xx=0,yy=0,nowT;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			xx+=cos((T[i]+T[j])/L*Pi)*(n-(j-i)*2),yy+=sin((T[i]+T[j])/L*Pi)*(n-(j-i)*2);
	xx*=6.0/n/(n-1)/(n-2);yy*=6.0/n/(n-1)/(n-2);
	printf("%.15lf %.15lf",xx,yy);
} 