#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 10;
const long double pi = acos(-1);
int main() {
  int n, tot;
  long double x = 0, y = 0, l, t[N], pos;
  cin >> n >> l;
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      pos = (t[j] + t[i]);
      x += cos(pos * pi / l) * (n - j + i - 2 - j + i);
      y += sin(pos * pi / l) * (n - j + i - 2 - j + i);
    }
  tot = (((n * (n - 1)) / 2) * (n - 2)) / 3;
  cout << fixed << setprecision(20) << x / tot << ' ' << fixed
       << setprecision(20) << y / tot << endl;
}
