#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, L, T[3000];
  map<long long, double> SUM;
  double ANSX = 0, ANSY = 0, PI = 3.14159265358979323846;
  cin >> N >> L;
  L *= 2;
  for (int i = 0; i < N; i++) cin >> T[i], T[i] *= 2;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) continue;
      if (i < j)
        SUM[((T[i] + T[j]) / 2) % L] += (i - j - 1 + N) % N;
      else
        SUM[((T[i] + T[j] + L) / 2) % L] += (i - j - 1 + N) % N;
    }
  }
  for (auto it = SUM.begin(); it != SUM.end(); it++) {
    long long i = it->first;
    ANSX += it->second * cos(2 * PI * it->first / L);
    ANSY += it->second * sin(2 * PI * it->first / L);
  }
  ANSX /= (double)(N * (N - 1) * (N - 2) / 6),
      ANSY /= (double)(N * (N - 1) * (N - 2) / 6);
  printf("%.12lf %.12lf\n", ANSX, ANSY);
}
