#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N=3005,inf=0x3f3f3f3f;
const ld PI=3.1415926535897932384626;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,L,a[N];
ld b[N],ansx,ansy;
int main(){
//	freopen("balance.in","r",stdin);
//	freopen("balance.out","w",stdout);
	n=read();L=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++)
	for (int j=i+1;j<=n;j++){
		ansx+=(n+i*2-j*2)*cos(PI*(a[i]+a[j])/L);
		ansy+=(n+i*2-j*2)*sin(PI*(a[i]+a[j])/L);
	}
	ll s=(ll)n*(n-1)*(n-2)/6;
	ansx/=s;ansy/=s;
	printf("%.16Lf %.16Lf\n",ansx,ansy);
	return 0;
}