#include <cstdio>
#include <cmath>

typedef double re;
const int MN = 3005;
const re PI = acos(-1);

int N, l, t[MN];
re Ansx, Ansy;

int main() {
	scanf("%d%d", &N, &l);
	for (int i = 1; i <= N; ++i) scanf("%d", &t[i]);
	for (int i = 1; i < N; ++i) {
		for (int j = i + 1; j <= N; ++j) {
			re Ax = cos(PI * (t[i] + t[j]) / l);
			re Ay = sin(PI * (t[i] + t[j]) / l);
			Ansx += Ax * (N - 2 * (j - i));
			Ansy += Ay * (N - 2 * (j - i));
		}
	}
	re iCN3 = 6. / N / (N - 1) / (N - 2);
	printf("%.15lf %.15lf\n", Ansx * iCN3, Ansy * iCN3);
	return 0;
}