#include<bits/stdc++.h>
using namespace std;

typedef long long LL;

const int N=200000;
const double pi=acos(-1);

int n,l;
double a[N+9];

void into(){
  scanf("%d%d",&n,&l);
  for (int i=1;i<=n;++i)
	scanf("%lf",&a[i]);
}

double ans[2];

void Get_ans(){
  for (int i=1;i<=n;++i)
	for (int j=i+1;j<=n;++j){
	  ans[0]+=cos(pi*(a[i]+a[j])/l)*(n-(j-i+1));
	  ans[1]+=sin(pi*(a[i]+a[j])/l)*(n-(j-i+1));
	  ans[0]+=cos(pi*(a[i]+a[j]+l)/l)*(j-i-1);
	  ans[1]+=sin(pi*(a[i]+a[j]+l)/l)*(j-i-1);
	}
  double t=1.0*n*(n-1)*(n-2)/6;
  ans[0]/=t;ans[1]/=t;
}

void work(){
  Get_ans();
}

void outo(){
  printf("%.10lf %.10lf\n",ans[0],ans[1]);
}

int main(){
  into();
  work();
  outo();
  return 0;
}