#include <bits/stdc++.h>
template <class T1, class T2>
inline bool cmin(T1 &a, const T2 &b) {
  return b < a ? (a = b, true) : false;
}
template <class T1, class T2>
inline bool cmax(T1 &a, const T2 &b) {
  return a < b ? (a = b, true) : false;
}
struct Complex {
  double x, y;
  Complex operator+=(const Complex &o) {
    x += o.x;
    y += o.y;
    return *this;
  }
  Complex operator/=(double k) {
    x /= k;
    y /= k;
    return *this;
  }
};
Complex operator+(const Complex &a, const Complex &b) {
  return {a.x + b.x, a.y + b.y};
}
Complex operator-(const Complex &a, const Complex &b) {
  return {a.x - b.x, a.y - b.y};
}
double abs(const Complex &z) { return sqrt(z.x * z.x + z.y * z.y); };
Complex operator*(const Complex &a, double k) { return {a.x * k, a.y * k}; }
Complex operator*(const Complex &a, const Complex &b) {
  return {a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x};
}
Complex operator/(const Complex &a, const Complex &b) {
  double l = b.x * b.x + b.y * b.y;
  return {(a.x * b.x + a.y * b.y) / l, (a.y * b.x - a.x * b.y) / l};
}
Complex cis(double a) { return {cos(a), sin(a)}; }
const int N = 3000;
const double PI = acos(-1);
int n, l, t[N];
Complex p[N], ans;
int main() {
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; ++i) scanf("%d", t + i);
  std::sort(t, t + n);
  for (int i = 0; i < n; ++i) p[i] = cis(2 * PI * t[i] / l);
  for (int i = 0; i < n; ++i) {
    Complex sum = {0, 0};
    for (int j = i + 1; j < i + n; ++j) {
      Complex v = p[j % n] - p[i],
              m = cis(PI * (t[i] + t[j % n] + j / n * l + l) / l);
      v /= abs(v);
      ans += sum / v * (p[j % n] - m) + m * (j - i - 1);
      sum += v;
    }
  }
  ans /= 1.0 * n * (n - 1) * (n - 2) / 2;
  printf("%.18f %.18f\n", ans.x, ans.y);
  return 0;
}
