#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#define N 3456
template<typename T> inline void read(T &x) {
	x = 0; char c = getchar();
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
}
using namespace std;
int n, l;
int t[N];
const double PI = 3.141592653589793238462643383;
int main() {
	read(n), read(l);
	for (int i = 1; i <= n; ++i)	read(t[i]);
	double ansx = 0, ansy = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			double x = cos(PI * (t[i] + t[j]) / l), y = sin(PI * (t[i] + t[j]) / l);
			ansx += x * (n - (j - i + 1));
			ansy += y * (n - (j - i + 1));
			x = cos(PI + PI * (t[i] + t[j]) / l), y = sin(PI + PI * (t[i] + t[j]) / l);
			ansx += x * (j - i - 1);
			ansy += y * (j - i - 1);
		}
	}
	ansx /= (1ll * n * (n - 1) * (n - 2) / 6);
	ansy /= (1ll * n * (n - 1) * (n - 2) / 6);
	printf("%.10lf %.10lf\n", ansx, ansy);
	return 0;
}
