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

typedef long long ll;

ll N, L;
vector<ll> T;
typedef complex<double> Complex;
Complex R;

int main() {
  cin >> N >> L;
  T.resize(N);
  for (ll i = 0; i < N; ++i) cin >> T[i];
  for (ll i = 0; i < N; ++i)
    for (ll j = i + 2; j < i + N; ++j) {
      double a = 2 * M_PI * T[i] / L,
             b = 2 * M_PI * (1. * T[j % N] / L + j / N);
      double w = 1. * (j - i - 1) / (N * (N - 1) * (N - 2) / 6);
      R += w * exp(Complex(0, (a + b) / 2 + M_PI));
    }
  cout << setprecision(15) << R.real() << " " << R.imag() << endl;
  return 0;
}
