#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <cmath>

using namespace std;

typedef long long ll;
const double pi = 2 * asin(1.0);

int main()
{
  int n;
  ll l;
  cin >> n >> l;
  vector<ll> t(n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    t[i] = x;
  }

  double sumX = 0.0;
  double sumY = 0.0;
  ll denom = 0;

  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      denom += n - 2;
      double angle1 = pi * (t[i] + t[j]) / l;
      double w1 = j - i - 1;
      double angle2 = pi * (t[i] + t[j] + l) / l;
      double w2 = n - 2 - w1;

      swap(w1, w2);

      sumX += w1 * cos(angle1) + w2 * cos(angle2);
      sumY += w1 * sin(angle1) + w2 * sin(angle2);
    }
  }

  sumX /= denom;
  sumY /= denom;

  sumX *= 3;
  sumY *= 3;

  printf("%.10lf %.10lf\n", sumX, sumY);

  return 0;
}
