#include <bits/stdc++.h>
using namespace std;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i];
    if (i != v.size() - 1) cout << endl;
  };
  return os;
}
template <typename T>
void Out(T x) {
  cout << x << endl;
}
template <typename T1, typename T2>
void Ans(bool first, T1 y, T2 n) {
  if (first)
    Out(y);
  else
    Out(n);
}
using vec = vector<long long>;
using mat = vector<vec>;
using Pii = pair<long long, long long>;
using PiP = pair<long long, Pii>;
using PPi = pair<Pii, long long>;
using bools = vector<bool>;
using pairs = vector<Pii>;
const long long mod = 998244353;
signed main() {
  long long N, L;
  cin >> N >> L;
  vec T(N);
  cin >> T;
  double x = 0.0, y = 0.0;
  vector<vector<double>> dist(N, vector<double>(N));
  for (long long i = (0); i < (N); i++)
    for (long long j = (0); j < (N); j++) {
      double theta = 2.0 * M_PI * (double)llabs(T[i] - T[j]) / L;
      dist[i][j] = 2.0 * sin(theta / 2.0);
    }
  vector<double> X(N), Y(N);
  for (long long i = (0); i < (N); i++) {
    X[i] = cos(2.0 * M_PI * (double)T[i] / L);
    Y[i] = sin(2.0 * M_PI * (double)T[i] / L);
  }
  for (long long i = (0); i < (N); i++)
    for (long long j = (0); j < (i); j++)
      for (long long k = (0); k < (j); k++) {
        double second = dist[i][j] + dist[j][k] + dist[k][i];
        x += X[i] * dist[j][k] / second;
        y += Y[i] * dist[j][k] / second;
        x += X[j] * dist[k][i] / second;
        y += Y[j] * dist[k][i] / second;
        x += X[k] * dist[i][j] / second;
        y += Y[k] * dist[i][j] / second;
      }
  long long c = N * (N - 1) * (N - 2) / 6;
  x /= c;
  y /= c;
  cout << x << " " << y << endl;
  return 0;
}
