#include <bits/stdc++.h>
using namespace std;
using i64 = long;
const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;
static uint32_t xorsft_x = 123456789;
static uint32_t xorsft_y = 362436069;
static uint32_t xorsft_z = 521288629;
static uint32_t xorsft_w = 88675123;
void initrand(uint32_t seed = 1928) {
  do {
    seed = seed * 1812433253 + 1;
    seed ^= seed << 13;
    seed ^= seed >> 17;
    xorsft_x = 123464980 ^ seed;
    seed = seed * 1812433253 + 1;
    seed ^= seed << 13;
    seed ^= seed >> 17;
    xorsft_y = 3447902351 ^ seed;
    seed = seed * 1812433253 + 1;
    seed ^= seed << 13;
    seed ^= seed >> 17;
    xorsft_z = 2859490775 ^ seed;
    seed = seed * 1812433253 + 1;
    seed ^= seed << 13;
    seed ^= seed >> 17;
    xorsft_w = 47621719 ^ seed;
  } while (xorsft_x == 0 && xorsft_y == 0 && xorsft_z == 0 && xorsft_w == 0);
}
double urand() {
  uint32_t t;
  t = xorsft_x ^ (xorsft_x << 11);
  xorsft_x = xorsft_y;
  xorsft_y = xorsft_z;
  xorsft_z = xorsft_w;
  xorsft_w ^= t ^ (t >> 8) ^ (xorsft_w >> 19);
  return ((xorsft_x + 0.5) / 4294967296.0 + xorsft_w) / 4294967296.0;
}
signed main() {
  int n, l;
  cin >> n >> l;
  initrand();
  vector<int> t(n);
  vector<double> x(n), y(n);
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
    x[i] = cos(2.0 * M_PI * t[i] / l);
    y[i] = sin(2.0 * M_PI * t[i] / l);
  }
  vector<vector<double>> dist(n, vector<double>(n, 0));
  int cnt = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      double xd = x[i] - x[j];
      double yd = y[i] - y[j];
      dist[i][j] = sqrt(xd * xd + yd * yd);
      ++cnt;
    }
  double sx = 0, sy = 0;
  double per = min(1.0, 1e8 / i64(n) * (n - 1) * (n - 2) / 2);
  for (int i = 0; i < n; ++i) {
    double d_sum = 0;
    cnt = 0;
    for (int j = 0; j < n; ++j)
      for (int k = j + 1; k < n; ++k) {
        if (i == j || i == k) continue;
        if (per > urand()) {
          ++cnt;
          d_sum += dist[j][k] / (dist[i][j] + dist[j][k] + dist[i][k]);
        }
      }
    d_sum /= cnt;
    sx += d_sum * x[i];
    sy += d_sum * y[i];
  }
  sx /= n;
  sy /= n;
  sx *= 3;
  sy *= 3;
  printf("%.20lf %.20lf\n", sx, sy);
}
