#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, L, t[2005];
double X, Y;
int main() {
  n = read(), L = read();
  for (int i = 1; i <= n; ++i) {
    t[i] = read();
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      X += (n - 2 * (j - i)) * cos(PI * (t[i] + t[j]) / L);
      Y += (n - 2 * (j - i)) * sin(PI * (t[i] + t[j]) / L);
    }
  }
  long long all = 1LL * n * (n - 1) * (n - 2) / 6;
  printf("%.12lf %.12lf\n", X / all, Y / all);
  return 0;
}
