#include<bits/stdc++.h>
using namespace std;
const double Pi=acos(-1.0); 
const int N=3005;
double ans1,ans2;
int a[N],n,L;
int main(){
	scanf("%d%d",&n,&L);
	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 x1=cos(2*Pi*(a[i]+a[j])/L/2),y1=sin(2*Pi*(a[i]+a[j])/L/2);
			ans1+=(double)x1*(n-1-(j-i));
			ans2+=(double)y1*(n-1-(j-i));
			x1=cos(Pi+2*Pi*(a[i]+a[j])/L/2),y1=sin(Pi+2*Pi*(a[i]+a[j])/L/2);
			ans1+=(double)x1*(j-i-1);
			ans2+=(double)y1*(j-i-1);
		}
	printf("%.10lf %.10lf\n",ans1/((double)n*(n-1)*(n-2)/6),ans2/((double)n*(n-1)*(n-2)/6));	
}