#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3010;
const long double pi = acosl(-1);
int num[MAXN], n, l;
long double sum1, sum2, sum;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> l;
  for (register int i = 1; i <= n; i++) cin >> num[i];
  for (register int i = 1; i <= n; i++)
    for (register int j = i + 1; j <= n; j++)
      sum1 += (n - ((j - i) << 1)) * cosl(pi * (num[i] + num[j]) / l),
          sum2 += (n - ((j - i) << 1)) * sinl(pi * (num[i] + num[j]) / l);
  sum = n * (n - 1) * (n - 2) / 6;
  cout << setprecision(18) << sum1 / sum << " " << sum2 / sum << endl;
  return 0;
}
