#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 10;
const double pi = acos(-1);
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n, l, t[N];
double x, y, tt;
int main() {
  cin >> n >> l;
  tt = 1.0 * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; i++) t[i] = gi();
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      x += cos(pi * (t[i] + t[j]) / l) * (n - (j - i + 1));
      y += sin(pi * (t[i] + t[j]) / l) * (n - (j - i + 1));
      x += cos(pi * (t[i] + t[j] + l) / l) * (j - i - 1);
      y += sin(pi * (t[i] + t[j] + l) / l) * (j - i - 1);
    }
  x /= tt, y /= tt;
  cout << setprecision(10) << fixed << x << ' ' << y << endl;
  return 0;
}
