#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

using ld = long double;
int main(){
    cout<<fixed<<setprecision(12);
    int n;
    cin>>n;
    vector<complex<ld>> a(n);
    ld l;
    const ld pi = acos(-1);
    cin>>l;
    rep(i,n){
        ld x;
        cin>>x;
        a[i]=complex<ld>(cos(x*pi/l),sin(x*pi/l));
    }
    complex<ld> ans=0;
    rep(i,n)rep(j,i){
        ans-=((ld)1.0*(i-j-1))*a[i]*a[j];
        ans+=((ld)1.0*(n-2-(i-j-1)))*a[i]*a[j];
    }
    ans*=6.0/n/(n-1)/(n-2);
    cout<<ans.real()<<" "<<ans.imag()<<endl;
    return 0;

}