#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

typedef double db;

const int MAXN = 3005;
const db PI = acos(-1);

int n,L;
int T[MAXN];

db 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++)
		{
			db arc = PI * (T[i] + T[j]) / L;
			ansX += (j - i - 1) * cos(arc + PI) + (n - j + i - 1) * cos(arc);
			ansY += (j - i - 1) * sin(arc + PI) + (n - j + i - 1) * sin(arc);
		}
	ansX /= (db)n * (n - 1) * (n - 2) / 6;
	ansY /= (db)n * (n - 1) * (n - 2) / 6;
	printf("%.10lf %.10lf\n",ansX,ansY);
	return 0;
}