#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#define pi 3.14159265358979323846
using namespace std;
const int N = 3010;
int n , L;
int t[N];
int main()
{
	scanf("%d%d" , &n , &L);
	for(int i = 1 ; i <= n ; ++i) scanf("%d" , &t[i]);
	double ansx = 0 , ansy = 0;
	for(int i = 1 ; i <= n ; ++i)
		for(int j = i + 1 ; j <= n ; ++j)
		{
			double tmp = pi * (t[i] + t[j]) / L;
			ansx += cos(tmp) * (n - 2 * (j - i - 1) - 2);
			ansy += sin(tmp) * (n - 2 * (j - i - 1) - 2);
		}
	ansx /= (double)n * (n - 1) * (n - 2) / 6.0;
	ansy /= (double)n * (n - 1) * (n - 2) / 6.0;
	printf("%.10f %.10f" , ansx , ansy);
	return 0;
}