#include <bits/stdc++.h>
using namespace std;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
struct edge {
  int to, cost;
};
int main() {
  int n, l;
  cin >> n >> l;
  vector<int> t(n);
  double ansx = 0, ansy = 0;
  for (int i = 0; i < n; i++) cin >> t[i];
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      int p = abs(i - j);
      ansx += (p - 1) * cos(((double)(t[i] + t[j]) * acos(-1)) / (double)l +
                            acos(-1)) +
              (n - p - 1) * cos((double)(t[i] + t[j]) * acos(-1) / (double)l);
      ansy += (p - 1) *
                  sin((double)(t[i] + t[j]) * acos(-1) / (double)l + acos(-1)) +
              (n - p - 1) * sin((double)(t[i] + t[j]) * acos(-1) / (double)l);
    }
  cout << fixed;
  cout << setprecision(15) << ansx / (double)((n * (n - 1) * (n - 2)) * 6)
       << " " << ansy / (double)((n * (n - 1) * (n - 2)) * 6) << endl;
}
