#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
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;
}
const int N = 3e3 + 5;
const double pi = 3.14159265358979323846;
int n , L;
double t[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;j <= n;j ++)
	{
		int 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 /= 1ll * n * (n - 1) * (n - 2) / 6;
	ansy /= 1ll * n * (n - 1) * (n - 2) / 6;
	printf("%.12f %.12f\n",ansx,ansy);
	return 0;
}