#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline int read() {
  int x = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return w == 1 ? x : -x;
}
int n, l, t[1000005];
const long double pi = acos(-1.0);
int main() {
  n = read();
  l = read();
  for (int i = 1; i <= n; i++) t[i] = read();
  long double ax = 0, ay = 0;
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++) {
      ax += (n - 1 - j + i) * cos(pi * (long double)(t[i] + t[j]) / l);
      ax -= (j - i - 1) * cos(pi * (long double)(t[i] + t[j]) / l);
      ay += (n - 1 - j + i) * sin(pi * (long double)(t[i] + t[j]) / l);
      ay -= (j - i - 1) * sin(pi * (long double)(t[i] + t[j]) / l);
    }
  long long t = n * (n - 1) * (n - 2) / 6;
  ax /= t;
  ay /= t;
  printf("%.15Lf %.15Lf\n", ax, ay);
  return 0;
}
