#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll N; cin >> N;
  double L; cin >> L;
  double T[N]; rep(i,N) cin >> T[i];

  double rx = 0, ry = 0;
  rep(i,N) repr(j,i+1,N) {
    double theta1 = ((double)(T[i]+T[j])/2)*M_PI*2/L;
    double theta2 = (theta1<M_PI) ? theta1 + M_PI : theta1 - M_PI;
    // cout << theta1 << "->" << (N+i)-j-1 << " ";
    // cout << theta2 << "->" << j-i-1 << endl;
    rx += cos(theta1)*((N+i)-j-1) + cos(theta2)*(j-i-1);
    ry += sin(theta1)*((N+i)-j-1) + sin(theta2)*(j-i-1);
  }
  rx /= N*(N-1)*(N-2)/6; ry /= N*(N-1)*(N-2)/6;
  cout << fixed << setprecision(10) << rx << " " << ry << endl;
  // cout << result << endl;
  return 0;
}