#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const long long INF = 1e9 + 47;
const long long LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 3000 + 7;
int n, l;
int t[N];
pair<double, double> get(double alpha, double beta, double gamma) {
  double raz = sin((beta - gamma) / 2);
  double dwa = sin((alpha - gamma) / 2);
  double trj = sin((alpha - beta) / 2);
  return {(cos(alpha) * raz + cos(beta) * dwa + cos(gamma) * trj) /
              (raz + dwa + trj),
          (sin(alpha) * raz + sin(beta) * dwa + sin(gamma) * trj) /
              (raz + dwa + trj)};
}
int random(int l, int r) { return l + rng() % (r - l + 1); }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> l;
  for (int i = (0); i < (n); ++i) cin >> t[i];
  bool big = n >= 400;
  double x = 0, y = 0;
  int cnt = 0;
  for (int i = (0); i < (n); ++i)
    for (int j = (i + 1); j < (n); ++j) {
      if (big) {
        for (int it = (0); it < (5); ++it) {
          int k = random(j + 1, n - 1);
          cnt++;
          double alpha = 2 * PI * t[i] / l;
          double beta = 2 * PI * t[j] / l;
          double gamma = 2 * PI * t[k] / l;
          auto tut = get(gamma, beta, alpha);
          x += tut.first;
          y += tut.second;
        }
        continue;
      }
      for (int k = (j + 1); k < (n); ++k) {
        cnt++;
        double alpha = 2 * PI * t[i] / l;
        double beta = 2 * PI * t[j] / l;
        double gamma = 2 * PI * t[k] / l;
        auto tut = get(gamma, beta, alpha);
        x += tut.first;
        y += tut.second;
      }
    }
  x /= cnt;
  y /= cnt;
  cout << fixed << setprecision(15) << x << ' ' << y << endl;
  cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
