int main(){
  int N, L;
  cin >> N >> L;
  vector<int> T(N);
  for (int i=0;i<N;i++){
    cin >> T.at(i);
  }
  /*vector<vector<double>> Alterc(N, vector<double>(N));
  vector<vector<double>> Alters(N, vector<double>(N));
  for (int i=0;i<N;i++){
    for (int j=0;j<N;j++){
      Alterc.at(i).at(j) = cos(pi*(T.at(i) + T.at(j))/L);
      Alters.at(i).at(j) = sin(pi*(T.at(i) + T.at(j))/L);
    }
  }*/
  double x = 0, y = 0;
  for (int i=0;i<N-2;i++){
    for (int j=i+1;j<N-1;j++){
      x += (N-j-1)*cos(pi*(T.at(i) + T.at(j))/L);
      x += (i+1)*cos(pi*(T.at(i+1) + T.at(j+1))/L);
      x -= (j-i)*cos(pi*(T.at(i) + T.at(j+1))/L);
      y += (N-j-1)*sin(pi*(T.at(i) + T.at(j))/L);
      y += (i+1)*sin(pi*(T.at(i+1) + T.at(j+1))/L);
      y -= (j-i)*sin(pi*(T.at(i) + T.at(j+1))/L);
    }
  }
  x *= 6.0;
  x /= N * (N - 1) * (N - 2);
  y *= 6.0;
  y /= N * (N - 1) * (N - 2);
  printf("%.18lf %.18lf\n", x, y);
  return 0;
}