#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const double pi=acos(-1);
int n,L,a[3005];
double ansx,ansy;
int main(){
	scanf("%d%d",&n,&L);
	For(i,1,n) scanf("%d",&a[i]);
	ll val=1ll*n*(n-1)*(n-2)/6;
	For(i,1,n) For(j,i+1,n){
		int len=j-i-1,val=n-2-2*len;
		//printf("%d %d %d\n",i,j,val);
		ansx+=val*cos(pi*(a[i]+a[j])/L);
		ansy+=val*sin(pi*(a[i]+a[j])/L);
	}
	ansx/=val; ansy/=val;
	printf("%.15lf %.15lf\n",ansx,ansy);
}