#include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void read(_T &f) {
  f = 0;
  _T fu = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fu = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    f = (f << 3) + (f << 1) + (c & 15);
    c = getchar();
  }
  f *= fu;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x < 10)
    putchar(x + 48);
  else
    print(x / 10), putchar(x % 10 + 48);
}
template <typename T>
void print(T x, char t) {
  print(x);
  putchar(t);
}
const double PI = acos(-1.0);
const int N = 1005;
int a[N];
double sx, sy;
int n, L;
int main() {
  read(n);
  read(L);
  for (register int i = 1; i <= n; i++) read(a[i]);
  for (register int i = 1; i <= n; i++) {
    for (register int j = i + 1; j <= n; j++) {
      double a1 = (double)(a[i] + a[j]) / 2 / L, a2 = a1 + 0.5;
      if (a2 >= 1) a2 -= 1;
      sx += cos(a1 * 2 * PI) * (n - (j - i + 1));
      sy += sin(a1 * 2 * PI) * (n - (j - i + 1));
      sx += cos(a2 * 2 * PI) * (j - i - 1);
      sy += sin(a2 * 2 * PI) * (j - i - 1);
    }
  }
  long long cnt = 1ll * n * (n - 1) * (n - 2) / 6;
  printf("%.9lf %.9lf\n", sx / cnt, sy / cnt);
  return 0;
}
