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

constexpr double pi = acos(-1.0);

int main() {
    int n, l; cin >> n >> l;
    vector<double> x(n), y(n);
    for(int i = 0; i < n; ++i) {
        double t; cin >> t;
        x[i] = cos(2 * pi * t / l);
        y[i] = sin(2 * pi * t / l);
    }
    vector<vector<double>> len(n, vector<double>(n));
    for(int i = 0; i < n; ++i) {
        for(int j = 1; j < n; ++j) {
            len[i][j] = len[j][i] = hypot(x[i] - x[j], y[i] - y[j]);
        }
    }

    double ans_x = 0, ans_y = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = i + 1; j < n; ++j) {
            for(int k = j + 1; k < n; ++k) {
                const double a = len[j][k], b = len[k][i], c = len[i][j];
                ans_x += (a * x[i] + b * x[j] + c * x[k]) / (a + b + c);
                ans_y += (a * y[i] + b * y[j] + c * y[k]) / (a + b + c);
            }
        }
    }
    ans_x /= (double)n * (n - 1) * (n - 2) / 6;
    ans_y /= (double)n * (n - 1) * (n - 2) / 6;

    cout << fixed << setprecision(10) << ans_x << " " << ans_y << endl;
}
