#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);
  for (register int i = 1; i < n; i++)
    for (register int j = i + 1; j < n; j++)
      for (register int k = j + 1; 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;
}
