#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct UnionFind {
  vector<int> par;
  UnionFind(int n) : par(n) {
    for (int i = 0, i_len = (n); i < i_len; ++i) par[i] = i;
  }
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
  int same(int x, int y) { return root(x) == root(y); }
};
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
  long long n, l;
  cin >> n >> l;
  int* v = new int[n];
  double* s = new double[l * 2];
  double* c = new double[l * 2];
  for (int i = 0, i_len = (n); i < i_len; ++i) {
    cin >> v[i];
  }
  for (int i = 0, i_len = (l * 2); i < i_len; ++i) {
    s[i] = sin(M_PI * i / l);
    c[i] = cos(M_PI * i / l);
  }
  double x = 0, y = 0;
  for (int i = 0, i_len = (n - 2); i < i_len; ++i) {
    for (int j = (i + 1), j_len = (n - 1); j < j_len; ++j) {
      for (int k = (j + 1), k_len = (n); k < k_len; ++k) {
        double A = abs(s[(v[k] - v[j] + l * 2) % (l * 2)]);
        double B = abs(s[(v[i] - v[k] + l * 2) % (l * 2)]);
        double C = abs(s[(v[j] - v[i] + l * 2) % (l * 2)]);
        x += (A * c[v[i] * 2 % (l * 2)] + B * c[v[j] * 2 % (l * 2)] +
              C * c[v[k] * 2 % (l * 2)]) /
             (A + B + C);
        y += (A * s[v[i] * 2 % (l * 2)] + B * s[v[j] * 2 % (l * 2)] +
              C * s[v[k] * 2 % (l * 2)]) /
             (A + B + C);
      }
    }
  }
  cout << x / (n * (n - 1) * (n - 2) / 6) << endl;
  cout << y / (n * (n - 1) * (n - 2) / 6) << endl;
  return 0;
}
