#include<bits/stdc++.h>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define PI 3.14159265358979323846

ll N,L;
ll T[3030];
ll i, j, k;
double ansx, ansy;



int main(){
    scanf("%lld%lld", &N,&L);
    fornum(i,0,N){
        scanf("%lld", &T[i]);
    }
    fornum(i,0,N){
        fornum(j,i+1,N){
            ansx += cos(PI * (double)(T[i] + T[j]) / L) * (N - 1 - j + i);
            ansy += sin(PI * (double)(T[i] + T[j]) / L) * (N - 1 - j + i);
            ansx += cos(PI * (double)(T[i] + T[j]) / L + PI) * (j - i - 1);
            ansy += sin(PI * (double)(T[i] + T[j]) / L + PI) * (j - i - 1);
        }
    }
    ansx /= N * (N - 1) * (N - 2) / 6;
    ansy /= N * (N - 1) * (N - 2) / 6;
    printf("%.12lf %.12lf", ansx, ansy);

    return 0;
}