#include<bits/stdc++.h>

using namespace std;

typedef long double LD;
#define N 3200

const LD pi=acos(-1);
complex<LD> ans,agl[N];
int n,m,a[N];

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i){
		scanf("%d",a+i);
		agl[i]=polar((LD)1.0,pi*a[i]/m);
	}
	for (int i=1;i<=n;++i)
		for (int j=i+1;j<=n;++j)
			ans+=agl[i]*agl[j]*complex<LD>(((n-j)+(i-1)-(j-i-1)),0);
	ans=ans*complex<LD>(6.0/n/(n-1)/(n-2),0);
	printf("%.12Lf %.12Lf\n",ans.real(),ans.imag());
	
	return 0;
}
			