#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
int n, L;
long double t[MAXN], pre[2][2][MAXN][MAXN];
int main() {
  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++) {
      pre[0][0][i][j] =
          pre[0][0][i][j - 1] + cos(3.14159265358979323846 * (t[i] + t[j]) / L);
      pre[0][1][i][j] =
          pre[0][1][i][j - 1] + sin(3.14159265358979323846 * (t[i] + t[j]) / L);
    }
  for (int i = 1; i <= n; i++)
    for (int j = n; j > i; j--) {
      pre[1][0][i][j] = pre[1][0][i][j + 1] +
                        cos(3.14159265358979323846 * ((t[i] + t[j]) / L + 1));
      pre[1][1][i][j] = pre[1][1][i][j + 1] +
                        sin(3.14159265358979323846 * ((t[i] + t[j]) / L + 1));
    }
  long double ansx = 0, ansy = 0;
  for (int i = 1; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) {
      ansx += pre[0][0][j][n] + pre[1][0][i][j + 1];
      ansy += pre[0][1][j][n] + pre[1][1][i][j + 1];
      ansx += (n - j) * cos(3.14159265358979323846 * (t[i] + t[j]) / L);
      ansy += (n - j) * sin(3.14159265358979323846 * (t[i] + t[j]) / L);
    }
  ansx /= n * (n - 1) * (n - 2) / 6;
  ansy /= n * (n - 1) * (n - 2) / 6;
  printf("%.12lf %.12lf\n", (double)ansx, (double)ansy);
  return 0;
}
