#include <bits/stdc++.h>

using namespace std;

const double PI = acos(-1.0); 
using cd = complex<double>;

void solve() {
    int n; double L;
    cin >> n >> L;
    vector<double> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    cd res;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            res += polar(1.0, PI*(a[i]+a[j])/L) * (double)(n-j-1 + i);
            res += polar(1.0, PI*(a[i]+a[j])/L + PI) * (double)(j - i - 1);
        }
    }
    double tot = double(n)*(n-1)*(n-2)/6;
    res /= tot;
    cout << fixed << setprecision(10);
    cout << res.real() << ' ' << res.imag();
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}
