#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);
	for(int i=1;i<=n;i++) scanf("%lf",&T[i]),T[i]/=L;
	double xx=0,yy=0,nowT;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			if(T[j]-T[i]>0.5) {
				nowT=(T[i]+T[j]+1)/2;
				xx+=cos(nowT*Pi)*(j-i-1),yy+=sin(nowT*Pi)*(j-i-1);
				nowT+=1.0/2;
				xx+=cos(nowT*Pi)*(n-j+i-1),yy+=sin(nowT*Pi)*(n-j+i-1);
			}
			else{
				nowT=(T[i]+T[j])/2;
				xx+=cos(nowT*Pi)*(n-j+i-1),yy+=sin(nowT*Pi)*(n-j+i-1);
				nowT+=1.0/2;
				xx+=cos(nowT*Pi)*(j-i-1),yy+=sin(nowT*Pi)*(j-i-1);
			}
		}
	xx*=6.0/n/(n-1)/(n-2);yy*=6.0/n/(n-1)/(n-2);
	printf("%.15lf %.15lf",xx,yy);
} 