#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1);

int main(){
  int N;
  long long L;
  cin >> N >> L;
  vector<double> T(N);
  for (int i=0;i<N;i++){
    scanf("%lf", &T.at(i));
    T.at(i) = 2.0 * pi * T.at(i) / L;
  }
  double rratio = 1.0 * N * (N - 1) * (N - 2) / 6.0;
  double x = 0, y = 0;
  for (int i=0;i<N-1;i++){
    for (int j=i+1;j<N;j++){
      double arg = (T.at(i)+T.at(j))/2.0;
      x += (N-2*j+2*i)*cos(arg);
      y += (N-2*j+2*i)*sin(arg);
    }
  }
  printf("%.15lf %.15lf\n", x/rratio, y/rratio);
  return 0;
}