#include <bits/stdc++.h>
using namespace std;
int main() {
  double pi = 3.141592653589;
  int N;
  long long int L;
  cin >> N >> L;
  double x[3005];
  for (int i = 1; i <= N; i++) cin >> x[i];
  double loong[3005][3005];
  for (int i = 1; i <= N - 1; i++)
    for (int j = i + 1; j <= N; j++)
      loong[i][j] = sqrt((cos(2 * pi * x[i] / L) - cos(2 * pi * x[j] / L)) *
                             (cos(2 * pi * x[i] / L) - cos(2 * pi * x[j] / L)) -
                         (sin(2 * pi * x[i] / L) - sin(2 * pi * x[j] / L)) *
                             (sin(2 * pi * x[i] / L) - sin(2 * pi * x[j] / L)));
  double ansx = 0;
  double ansy = 0;
  for (int i = 1; i <= N - 2; i++)
    for (int j = i + 1; j <= N - 1; j++)
      for (int t = j + 1; t <= N; t++) {
        double l = loong[i][j] + loong[j][t] + loong[t][i];
        ansx += (loong[i][j] * (cos(2 * pi * x[t] / L)) +
                 loong[j][t] * (cos(2 * pi * x[i] / L)) +
                 loong[t][i] * (cos(2 * pi * x[j] / L))) /
                l;
        ansy += (loong[i][j] * (sin(2 * pi * x[t] / L) +
                                loong[j][t] * (sin(2 * pi * x[i] / L)) +
                                loong[t][i] * (sin(2 * pi * x[j] / L)))) /
                l;
      }
  cout << fixed << setprecision(10) << ansx << " ";
  cout << fixed << setprecision(10) << ansy;
}
