#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  // For float output.
  cout << fixed << setprecision(10);

  int n, l;
  cin >> n >> l;
  vector<int> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  double x_sum = 0;
  double y_sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      double t1 = 2.0 * M_PI / l * xs[i];
      double t2 = 2.0 * M_PI / l * xs[j];

      double s1 = (t1 + t2) / 2.0 + M_PI;
      double s2 = (t1 + t2) / 2.0;

      int k1 = j - i - 1;
      int k2 = n - 2 - k1;

      x_sum += k1 * cos(s1);
      y_sum += k1 * sin(s1);
      x_sum += k2 * cos(s2);
      y_sum += k2 * sin(s2);
      if (DEBUG) cout << x_sum << " " << y_sum << endl;
    }
  }

  x_sum /= 1.0 * n * (n - 1) / 2.0 * (n - 2) / 3.0;
  y_sum /= 1.0 * n * (n - 1) / 2.0 * (n - 2) / 3.0;
  cout << x_sum << " " << y_sum << endl;
}
