#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -f;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) return;
  print(x / 10), putchar(x % 10 + 48);
}
void write(int x) {
  if (!x)
    putchar('0');
  else
    print(x);
  putchar('\n');
}
const int maxn = 1e6 + 10;
const int inf = 1e9;
const double eps = 1e-8;
const int mod = 1e9 + 7;
const double pi = acos(-1);
int n, L, t[maxn];
double x, y;
void get(int a, int b) {
  if (a > b) {
    double p = (t[b] + L - t[a]) / 2.0;
    double w = 1.0 * t[a] + p;
    if (w > L) w -= L;
    x += cos(2.0 * pi * w / L) * (a - b - 1);
    y += sin(2.0 * pi * w / L) * (a - b - 1);
  } else {
    double w = (t[a] + t[b]) / 2.0;
    x += cos(2.0 * pi * w / L) * (n - (b - a + 1));
    y += sin(2.0 * pi * w / L) * (n - (b - a + 1));
  }
}
int main() {
  read(n), read(L);
  for (int i = 1; i <= n; i++) read(t[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (i != j) get(i, j);
  double pps = n * (n - 1) * (n - 2) / 6.0;
  printf("%.10lf %.10lf\n", x / pps, y / pps);
  return 0;
}
