#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#define pi 3.14159265358979323846

using namespace std;
typedef long long ll;
typedef long double ld;
const int MAXN = 3005;
int n,L;
ld t[MAXN],pre[2][2][MAXN][MAXN];

int main()
{
	cin >> n >> L;
	for(int i = 1; i<=n; i++)
	    cin >> t[i];
	ld ansx = 0, ansy = 0;
	for(int i = 1; i<=n; i++)
		for(int j = i+1; j<=n; j++)
	    {
			int cnt = j-i-1;
			ld tmp = pi*(t[i]+t[j])/L;
			ansx += cos(tmp)*(n-2*cnt-2), ansy += sin(tmp)*(n-2*cnt-2);
		}
	ansx /= 1ll*n*(n-1)*(n-2)/6;
	ansy /= 1ll*n*(n-1)*(n-2)/6;
	printf("%.12lf %.12lf\n",(double)ansx,(double)ansy);
	return 0;
}
