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

#define ld long double
const ld pi = acos(-1);
int N , L , arr[3003]; ld avex , avey;

int main(){
	cin >> N >> L; for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
	
	for(int i = 1 ; i <= N ; ++i)
		for(int j = i + 1 ; j <= N ; ++j){
			int num = N - 2 - 2 * (j - i - 1);
			avex += num * cos(pi * (arr[i] + arr[j]) / L);
			avey += num * sin(pi * (arr[i] + arr[j]) / L);
		}

	avex = avex * 6 / N / (N - 1) / (N - 2);
	avey = avey * 6 / N / (N - 1) / (N - 2);
	cout << fixed << setprecision(10) << avex << ' ' << avey << endl; return 0;
}