#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T &Min(T &x, const T &y) {
  return y < x ? (x = y) : x;
}
template <typename T>
inline T &Max(T &x, const T &y) {
  return x < y ? (x = y) : x;
}
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int maxn = 3e3 + 10;
int n, L, T[maxn];
double ansx, ansy, tl;
int calc(int l, int r) {
  if (l <= r) return r - l + 1;
  return n - l + 1 + r;
}
int main() {
  n = read(), L = read(), tl = acos(-1.0) / L;
  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) {
      double c = (T[i] + T[j]) * tl;
      int cnt = calc(j, i) - calc(i, j);
      ansx += cos(c) * cnt;
      ansy += sin(c) * cnt;
    }
  ansx = ansx / n / (n - 1) / (n - 2) * 6;
  ansy = ansy / n / (n - 1) / (n - 2) * 6;
  printf("%.15lf %.15lf\n", ansx, ansy);
  return 0;
}
