#include<bits/stdc++.h>
using namespace std;
int a[3005];
int main(){
    double L,t,r,m,x=0.0,y=0.0;int n,i,j;
    scanf("%d%d",&n,&i);
    m=(6.0/(n*(n-1)))/(n-2);
    L=M_PI/i;
    for(i=1;i<=n;++i)scanf("%d",&a[i]);
    for(j=2;j<=n;++j)for(i=1;i!=j;++i){
        t=L*(a[i]+a[j]);
        r=m*(n-((j-i)<<1));
        x+=cos(t)*r;
        y+=sin(t)*r;
    }
    printf("%.15lf %.15lf",x,y);
    return 0;
}