#include <bits/stdc++.h>
using namespace std;
const int N = 3003;
const long double pi = acos(-1.0);
const long double eps = 1e-9;
long double ssin[N][N], scos[N][N];
int ang[N];
int n, L;
int prv(int i) { return i ? i - 1 : (n - 1); }
int nxt(int i) { return i + 1 < n ? i + 1 : 0; }
long double D(long double x, long double y) {
  return abs(2 * sin((y - x) * pi / L));
}
int LEN(int i, int j) {
  if (i <= j)
    return j - i;
  else
    return n - (j - i);
}
pair<long double, long double> solve() {
  for (auto i = (0); i < (n); i++) {
    ssin[i][i] = scos[i][i] = 0.0;
    int j = (i + 1) % n;
    while (j != i) {
      ssin[i][j] = ssin[i][j - 1];
      ssin[i][j] += abs(sin((ang[j] - ang[i]) * pi / L));
      scos[i][j] = scos[i][j - 1];
      scos[i][j] += abs(cos((ang[j] - ang[i]) * pi / L));
      j = (j + 1) % n;
    }
  }
  long double resx = 0, resy = 0;
  for (auto i = (0); i < (n); i++) {
    int j = (i + 1) % n;
    while (j != i) {
      long double a1 = (ang[i] + ang[j]) / 2.0;
      long double a2 = a1 + L / 2.0;
      while (a1 >= L) a1 -= L;
      while (a1 < 0) a1 += L;
      while (a2 >= L) a2 -= L;
      while (a2 < 0) a2 += L;
      if (ang[i] < ang[j] && (ang[i] < a2 + eps && ang[j] > a2 - eps))
        swap(a1, a2);
      else if (ang[i] > ang[j] && (ang[j] < a1 + eps && ang[i] > a1 - eps))
        swap(a1, a2);
      long double c1 = ssin[i][prv(j)] * D(ang[i], a1) +
                       sin(2 * pi * a1 / L) * LEN(i, prv(j));
      long double c2 = ssin[j][prv(i)] * D(ang[i], a2) +
                       sin(2 * pi * a2 / L) * LEN(j, prv(i));
      resy += c1 + c2;
      c1 = scos[i][prv(j)] * D(ang[i], a1) +
           cos(2 * pi * a1 / L) * LEN(i, prv(j));
      c2 = scos[j][prv(i)] * D(ang[i], a2) +
           cos(2 * pi * a2 / L) * LEN(j, prv(i));
      resx += c1 + c2;
      j = nxt(j);
    }
  }
  resy = resy / (n * (n - 1) * 1ll * (n - 2) / 6);
  resx = resx / (n * (n - 1) * 1ll * (n - 2) / 6);
  return {resx, resy};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> L;
  for (auto i = (0); i < (n); i++) cin >> ang[i];
  pair<long double, long double> kek = solve();
  cout.precision(15);
  cout << fixed << kek.first << ' ' << kek.second << endl;
  return 0;
}
