#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int n, L, a[3005];
double ansx, ansy;
int main() {
  scanf("%d%d", &n, &L);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%d", &a[i]);
  for (int i = (int)(1); i <= (int)(n); i++)
    for (int j = (int)(i + 1); j <= (int)(n); j++) {
      ansx += cos(pi * (a[i] + a[j]) / L) * (n - j + i - 1);
      ansy += sin(pi * (a[i] + a[j]) / L) * (n - j + i - 1);
      ansx += cos(pi * (a[i] + a[j] + L) / L) * (j - i - 1);
      ansy += sin(pi * (a[i] + a[j] + L) / L) * (j - i - 1);
    }
  ansx /= 1.0 * n * (n - 1) * (n - 2) / 6;
  ansy /= 1.0 * n * (n - 1) * (n - 2) / 6;
  printf("%.15lf %.15lf\n", ansx, ansy);
}
