#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef double db;

const int N=3e3+5;
const db pi=acos(-1);

int n,L;
db age[N];

int main() {
	scanf("%d%d",&n,&L);
	fo(i,1,n) {
		scanf("%lf",&age[i]);
		age[i]=2*pi*age[i]/L;
	}
	db anx=0,any=0;
	fo(i,1,n)
		fo(j,i+1,n) {
			db angle=(age[i]+age[j])/2;
			anx+=cos(angle)*(i-1+n-j);
			any+=sin(angle)*(i-1+n-j);
			angle=-pi+angle;
			anx+=cos(angle)*(j-i-1);
			any+=sin(angle)*(j-i-1);
		}
	db cnt=(db)n*(n-1)*(n-2)/6;
	printf("%.10lf %.10lf\n",anx/cnt,any/cnt);
	return 0;
}