#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int N = 3005;

int n, l, t[N];
double ax, ay;

#define db double

const db pi = acos(-1);

int main() {
	scanf("%d %d", &n, &l);
	fo(i, 1, n) scanf("%d", &t[i]);
	fo(i, 1, n) fo(j, i + 1, n) {
		int v = t[i] + t[j] - l;
		ax += cos(pi * v / l) * (j - i - 1);
		ay += sin(pi * v / l) * (j - i - 1);
		v += l;
		ax += cos(pi * v / l) * (n - (j - i + 1));
		ay += sin(pi * v / l) * (n - (j - i + 1));
	}
	ax /= (double) n * (n - 1) * (n - 2) / 6;
	ay /= (double) n * (n - 1) * (n - 2) / 6;
	pp("%.9lf %.9lf\n", ax, ay);
}
