#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;


using T = long double;
using P = complex<T>;

auto dot(P a, P b) { return real(conj(a)*b); }
auto cross(P a, P b) { return imag(conj(a)*b); }
auto cross(P a, P b, P c) { return cross(b-a, c-a); }

int sgn(auto x) { return (x > 0) - (x < 0); }


#ifdef LOCAL
#include "pretty_debug.h"
#else
#define debug(...) //ignore
#endif

int main() {
  cin.sync_with_stdio(0); cin.tie(0);
  cin.exceptions(cin.failbit);
  int n,l;
  cin>>n>>l;
  vector<ll> t(n);
  rep(i,0,n) cin>>t[i];

  P ans = 0;
  T cnt = 0;
  rep(i,0,n) rep(j,1,n) {
    ll t0 = t[i];
    ll t1 = t[(i+j)%n];
    T arg = (t0+t1)/(2.0*l);
    P p0 = polar<T>(1,2*M_PI*t0/(1.0*l));
    P p1 = polar<T>(1,2*M_PI*t1/(1.0*l));
    P p = polar<T>(1,2*M_PI*arg);
    if(t1 < t0) p = -p;
    T coeff = n-j-1;
    ans += p * coeff;
    cnt += coeff;
  }
  ans /= n*(n-1)*(n-2)/6.0;
  cout << setprecision(14);
  cout << real(ans) << " " << imag(ans) << endl;
}
