#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n,l; scanf("%d%d",&n,&l);
    vector<int> t(n);
    rep(i,0,n)scanf("%d",&t[i]);
    double ans[2];
    rep(i,0,n-1)rep(j,i+1,n){
        ans[0]+=(n-2*(j-i))*cos(M_PI*(t[i]+t[j])/l);
        ans[1]+=(n-2*(j-i))*sin(M_PI*(t[i]+t[j])/l);
    }
    ans[0]/=1LL*n*(n-1)*(n-2)/6;
    ans[1]/=1LL*n*(n-1)*(n-2)/6;
    printf("%.12f %.12f\n",ans[0],ans[1]);
    return 0;
}