#include <bits/stdc++.h>
using namespace std;
template <typename tn>
void read(tn &a) {
  tn x = 0, f = 1;
  char c = ' ';
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  a = x * f;
}
const long double pi = acosl(-1);
int n, L, T[5010];
long double ansx, ansy;
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 = i + 1; j <= n; j++) {
      ansx += cosl(pi * (T[i] + T[j]) / L) * (n - j + i - 1) +
              cosl(pi * (T[i] + T[j] + L) / L) * (j - i - 1);
      ansy += sinl(pi * (T[i] + T[j]) / L) * (n - j + i - 1) +
              sinl(pi * (T[i] + T[j] + L) / L) * (j - i - 1);
    }
  long double cnt = 1.l * n * (n - 1) * (n - 2) / 6;
  printf("%.10Lf %.10Lf\n", ansx / cnt, ansy / cnt);
  return 0;
}
