#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=3005;const db pie=acos(-1);
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
int n,a[MAXN],L;db ansx,ansy;
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read(),L=read();Rep(i,1,n)a[i]=read();
	Rep(i,1,n)Rep(j,i+1,n)ansx+=cos(pie*(a[i]+a[j])/L)*(n-2*(j-i)),ansy+=sin(pie*(a[i]+a[j])/L)*(n-2*(j-i));
	ansx/=1ll*n*(n-1)*(n-2)/6,ansy/=1ll*n*(n-1)*(n-2)/6,printf("%.10lf %.10lf",ansx,ansy);
	return 0;
}


