#include <bits/stdc++.h>
using namespace std;
int a[3003], i, j, m, n;
double b, c, d, e, s, t, x, y;
const double p = acos(-1);
int main() {
  for (scanf("%d%d", &n, &m), i = 1; i <= n; i++) scanf("%d", a + i);
  for (i = 1; i <= n; i++)
    for (j = i + 1, s = t = 0; j <= n; j++)
      b = cos(p * (m + a[i] + a[j]) / m), c = sin(p * (m + a[i] + a[j]) / m),
      d = cos(2 * p * a[i] / m) - b, e = sin(2 * p * a[i] / m) - c,
      x += (j - i - 1) * b + d * s - e * t,
      y += (j - i - 1) * c + d * t + e * s, s += cos(p * (a[j] - a[i]) / m),
      t += sin(p * (a[j] - a[i]) / m);
  return 0 * printf("%.15lf %.15lf\n", 6 * x / (n * (n - 1ll) * (n - 2)),
                    6 * y / (n * (n - 1ll) * (n - 2)));
}
