#include<cmath>
#include<cstdio>
#define N 3003
using namespace std;
int a[N],i,j,m,n;double b,c,d,e,s,t,x,y;const double p=acos(-1);
int main()
{
	for(scanf("%d%d",&n,&m),i=1;i<=n;i++)scanf("%d",a+i);
	for(i=1;i<=n;i++)for(j=i+1,s=t=0;j<=n;j++)b=cos(p*(a[i]+a[j])/m+p),c=sin(p*(a[i]+a[j])/m+p),d=cos(2*p*a[i]/m)-b,e=sin(2*p*a[i]/m)-c,x+=(j-i-1)*b+d*s-e*t,y+=(j-i-1)*c+d*t+e*s,s+=cos(p*(a[j]-a[i])/m),t+=sin(p*(a[j]-a[i])/m);
	return 0*printf("%.15lf %.15lf\n",6*x/(n*(n-1ll)*(n-2)),6*y/(n*(n-1ll)*(n-2)));
}