#include <bits/stdc++.h>
using namespace std;
void Debug() { cerr << '\n'; }
template <class FIRST, class... REST>
void Debug(FIRST arg, REST... rest) {
  cerr << arg << " ";
  Debug(rest...);
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  if (!v.empty()) {
    for (int i = int(0); i < int((int)(v).size() - 1); i++) out << v[i] << ", ";
    out << v.back();
  }
  out << "]";
  return out;
}
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& v) {
  out << "(" << v.first << ", " << v.second << ")";
  return out;
}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const long long mod = 1000000007;
const int inf = (1 << 30) - 1;
const long long linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng;
int N;
long long L;
long long A[MAX_N];
long long B[MAX_N];
void solve() {
  cin >> N >> L;
  for (int i = int(0); i < int(N); i++) cin >> A[i];
  long double rx = 0.0, ry = 0.0;
  sort(A, A + N);
  for (int i = int(0); i < int(N); i++) {
    B[0] = 0;
    for (int j = int(1); j < int(N); j++) {
      int idx = (j + i) % N;
      B[j] = (A[idx] - A[i] + L) % L;
    }
    long double tmp = 0;
    long double res = 0;
    for (int i = int(1); i < int(N); i++) {
      tmp += sin(PI * (L - B[i]) / L / 2) / cos(PI * (L - B[i]) / L / 2);
    }
    for (int i = int(1); i < int(N); i++) {
      tmp -= sin(PI * (L - B[i]) / L / 2) / cos(PI * (L - B[i]) / L / 2);
      res += sin(PI * B[i] / L / 2) / cos(PI * B[i] / L / 2) * tmp;
    }
    res /= N;
    res /= (N - 1);
    res /= (N - 2);
    res *= 3;
    rx += (1.5 / N - res) * cos(2 * PI * A[i] / L);
    ry += (1.5 / N - res) * sin(2 * PI * A[i] / L);
  }
  cout << rx << " " << ry << "\n";
}
uint32_t rd() {
  uint32_t res;
  res = std::random_device()();
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed;
  cout.precision(20);
  cerr << fixed;
  cerr.precision(6);
  rng.seed(rd());
  solve();
  cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
