#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std;
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;
}
#define pi 3.14159265358979323846
const int N = 3100;
int n,L;
double ansx,ansy;
double t[N],pre[2][2][N][N];
int main()
{
	n = read(); L = read();
	for(int i = 1;i <= n;i ++) t[i] = read();
	double ansx = 0,ansy = 0;
	for(int i = 1;i <= n;i ++)
		for(int j = i + 1,cnt;j <= n;j ++)
		{
			cnt = j - i - 1;
			double tmp = pi * (t[i] + t[j]) / L;
			ansx += cos(tmp) * (n - 2 * cnt - 2);
			ansy += sin(tmp) * (n - 2 * cnt - 2);
		}
	ansx = ansx / (1ll * n * (n - 1) * (n - 2) / 6); ansy = ansy / (1ll * n * (n - 1) * (n - 2) / 6);
	printf("%.12f %.12f\n",ansx,ansy);
	return 0;
}
