#include <bits/stdc++.h>
using namespace std;

const int maxn = 3010;
const double PI = acos(-1);
int n, L, a[maxn];

int main() {
    scanf("%d %d", &n, &L);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    double ansx = 0, ansy = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            ansx += (n - 2 * (j - i)) * cos(PI * (a[i] + a[j]) / L);
            ansy += (n - 2 * (j - i)) * sin(PI * (a[i] + a[j]) / L);
        }
    }
    long long t = 1LL * n * (n - 1) * (n - 2) / 6;
    printf("%.10f %.10f\n", ansx / t, ansy / t);
    return 0;
}