#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const int N = 3005;
const double Pi = acos(- 1.0);
int n, t[N], L;
double ansx, ansy;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read(); L = read();
	for(int i = 1; i <= n; i ++) t[i] = read();
	for(int i = 1; i <= n; i ++)
		for(int j = i + 1; j <= n; j ++)
		{
			int cnt = j - i - 1;
			double tmp = Pi * (double)(t[i] + t[j]) / L;
			ansx += cos(tmp) * (double)(n - 2 * cnt - 2);
			ansy += sin(tmp) * (double)(n - 2 * cnt - 2);
		}
	ansx /= (double)n * (n - 1) * (n - 2) / 6.0;
	ansy /= (double)n * (n - 1) * (n - 2) / 6.0;
	printf("%.12f %.12f\n", ansx, ansy);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
