#include <bits/stdc++.h>
#define PI 3.141592653589
using namespace std;
int n, L;
double t[3010];
int main() {
    scanf("%d%d", &n, &L);
    for (int i = 1; i <= n; i++) scanf("%lf", t + i), t[i] /= L;
    double ansx = 0, ansy = 0;
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++) {
            ansx += (j - i - 1) * cos((t[i] + t[j]) * PI + PI);
            ansx += (n - j + i - 1) * cos((t[i] + t[j]) * PI);
            ansy += (j - i - 1) * sin((t[i] + t[j]) * PI + PI);
            ansy += (n - j + i - 1) * sin((t[i] + t[j]) * PI);
        }
    double x = 1. * n * (n - 1) * (n - 2) / 6;
    return printf("%.10f %.10f\n", ansx / x, ansy / x), 0;
}