#include<bits/stdc++.h>
using namespace std;
const int N=3300;
const double pi=acos(-1.0);
long long n,a[N],L;
double X,Y;
int main(){
	scanf("%d%d",&n,&L),L<<=1;
	for(int i=0;i<n;i++) scanf("%d",a+i),a[i]<<=1;
	sort(a,a+n);
	for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){
		X+=(n+i-j-1)*cos(2*pi*(a[i]+a[j]>>1)/L)+(j-i-1)*cos(2*pi*(a[i]+a[j]+L>>1)/L);
		Y+=(n+i-j-1)*sin(2*pi*(a[i]+a[j]>>1)/L)+(j-i-1)*sin(2*pi*(a[i]+a[j]+L>>1)/L);
	}
	printf("%.15lf %.15lf\n",6*X/(n*(n-1)*(n-2)),6*Y/(n*(n-1)*(n-2)));
}
