#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
const double Pi = acos(-1);
int n, l, T[3000];
int main()
{
	scanf("%d%d", &n, &l);
	for (int i = 0; i < n; i++)
		scanf("%d", &T[i]);
    double ansX = 0, ansY = 0;
    for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			int inter = j - i - 1;
			int outer = n - inter - 2;
			double theta = Pi * (T[i] + T[j]) / l;
			ansX += (outer - inter) * cos(theta);
			ansY += (outer - inter) * sin(theta);
		}
	}
	ll all = (ll)n * (n - 1) * (n - 2) / 6;
	ansX /= all, ansY /= all;
	printf("%.15lf %.15lf\n", ansX, ansY);
}
