#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 3010;
const double pi = acos(-1.0);
int n,L,a[N];

int main(){
	n=read(),L=read();
	For(i,1,n) a[i]=read();
	double sx=0,sy=0;
	FOR(i,1,n)
		For(j,i+1,n){
			sx+=(n-2*(j-i))*cos(pi*(a[i]+a[j])/L);
			sy+=(n-2*(j-i))*sin(pi*(a[i]+a[j])/L);
		}
	ll c=1ll*n*(n-1)*(n-2)/6;
	printf("%0.15lf %0.15lf\n",sx/c,sy/c);
}