#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=3005;
const double pi=acos(-1.0);
int n,L;
int t[N];
double tx=0,ty=0;
int main(){
	n=read(),L=read();
	For(i,1,n)
		t[i]=read();
	For(i,1,n)
		For(j,i+1,n){
			int a=j-i-1,b=n-a-2;
			b-=a;
			int p=t[i]+t[j];
			tx+=cos(pi*p/L)*b;
			ty+=sin(pi*p/L)*b;
		}
	LL s=(LL)n*(n-1)*(n-2)/6;
	tx/=s,ty/=s;
	printf("%.10lf %.10lf\n",tx,ty);
	return 0;
}