#include <bits/stdc++.h>
using namespace std;
const int N = 3005, inf = 0x3f3f3f3f;
const double PI = 3.1415926535897932384626;
int read() {
  int f = 1, g = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) g = g * 10 + ch - '0';
  return f * g;
}
int n, L, a[N];
double b[N], dist[N][N];
long double ansx, ansy;
int main() {
  n = read();
  L = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      dist[i][j] = 2 * sin(PI * (a[j] - a[i]) / L);
  register int i, j, k;
  register double c0, c1, c2, c3, c4, c5;
  for (i = 1; i < n; i++)
    for (j = i + 1; j < n; j++) {
      for (k = j + 1; k + 5 <= n; k += 6) {
        c0 = 1 / (dist[i][j] + dist[j][k + 0] + dist[i][k + 0]);
        c1 = 1 / (dist[i][j] + dist[j][k + 1] + dist[i][k + 1]);
        c2 = 1 / (dist[i][j] + dist[j][k + 2] + dist[i][k + 2]);
        c3 = 1 / (dist[i][j] + dist[j][k + 3] + dist[i][k + 3]);
        c4 = 1 / (dist[i][j] + dist[j][k + 4] + dist[i][k + 4]);
        c5 = 1 / (dist[i][j] + dist[j][k + 5] + dist[i][k + 5]);
        b[i] += dist[j][k + 0] * c0 + dist[j][k + 1] * c1 +
                dist[j][k + 2] * c2 + dist[j][k + 3] * c3 +
                dist[j][k + 4] * c4 + dist[j][k + 5] * c5;
        b[j] += dist[i][k + 0] * c0 + dist[i][k + 1] * c1 +
                dist[i][k + 2] * c2 + dist[i][k + 3] * c3 +
                dist[i][k + 4] * c4 + dist[i][k + 5] * c5;
        b[k + 0] += dist[i][j] * c0;
        b[k + 1] += dist[i][j] * c1;
        b[k + 2] += dist[i][j] * c2;
        b[k + 3] += dist[i][j] * c3;
        b[k + 4] += dist[i][j] * c4;
        b[k + 5] += dist[i][j] * c5;
      }
      for (; k <= n; k++) {
        register double c = 1 / (dist[i][j] + dist[j][k] + dist[i][k]);
        b[i] += dist[j][k] * c;
        b[j] += dist[i][k] * c;
        b[k] += dist[i][j] * c;
      }
    }
  for (int i = 1; i <= n; i++) {
    ansx += cosl(PI * 2 * a[i] / L) * b[i];
    ansy += sinl(PI * 2 * a[i] / L) * b[i];
  }
  long long s = (long long)n * (n - 1) * (n - 2) / 6;
  ansx /= s;
  ansy /= s;
  printf("%.12Lf %.12Lf\n", ansx, ansy);
  return 0;
}
