#include <bits/stdc++.h>
using namespace std;

typedef double db;
const int maxn = 3000;
const db pi = acos(-1);
int n, k, a[maxn + 3];

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	db x = 0, y = 0;
	for (int i = 1; i < n; i++) {
		for (int j = i + 1; j <= n; j++) {
			x += cos(pi * (a[i] + a[j]) / k) * (i - 1 + n - j) + cos(pi * (a[i] + a[j]) / k + pi) * (j - i - 1);
			y += sin(pi * (a[i] + a[j]) / k) * (i - 1 + n - j) + sin(pi * (a[i] + a[j]) / k + pi) * (j - i - 1);
		}
	}
	db t = 6. / n / (n - 1) / (n - 2);
	x *= t, y *= t;
	printf("%.15lf %.15lf\n", x, y);
	return 0;
}