#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f = ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
const int N = 3005;
const long double pi = acos(-1.0);
int n, L;
int t[N];
long double tx = 0, ty = 0;
int main() {
  n = read(), L = read() * 2;
  for (int i = (1); i <= (n); i++) t[i] = read() * 2;
  for (int i = (1); i <= (n); i++)
    for (int j = (i + 1); j <= (n); j++) {
      int a = j - i - 1, b = n - a - 2;
      int pb = ((t[i] + t[j]) / 2) % L;
      int pa = (pb + L / 2) % L;
      tx += cos(pi * 2 * pa / L) * a;
      ty += sin(pi * 2 * pa / L) * a;
      tx += cos(pi * 2 * pb / L) * b;
      ty += sin(pi * 2 * pb / L) * b;
    }
  long long s = (long long)n * (n - 1) * (n - 2) / 6;
  tx /= s, ty /= s;
  printf("%.10lf %.10lf\n", (double)tx, (double)ty);
  return 0;
}
