#include <bits/stdc++.h>

using namespace std;

const int N = 3e3 + 5;
const double Pi = acos( -1.0 );
int _w;

int n , T[N] , L;
double ansx , ansy , theta;

int main( void ) {
  _w = scanf("%d%d",&n,&L);
  for( int i = 1 ; i <= n ; ++i )
    _w = scanf("%d",T+i);
  for( int i = 1 ; i <= n ; ++i )
    for( int j = i + 1 ; j <= n ; ++j ) {
      theta = Pi * ( (double)T[i] + T[j] ) / L;
      ansx += cos( theta ) * ( n - j + i - 1 );
      ansy += sin( theta ) * ( n - j + i - 1 );
      ansx += cos( theta + Pi ) * ( j - i - 1 );
      ansy += sin( theta + Pi ) * ( j - i - 1 );
    }
  ansx /= 1.0 * n * ( n - 1 ) * ( n - 2 ) / 6;
  ansy /= 1.0 * n * ( n - 1 ) * ( n - 2 ) / 6;
  printf("%.10f %.10f\n",ansx,ansy);
  return 0;
}
