#pragma GCC optimize("Ofast")

#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

using T = long double;
const T pi = acosl(-1);

struct point
{
    T x, y;

    point () : x(0), y(0) {}

    point (T x_, T y_) : x(x_), y(y_) {}

    point operator + (const point &o) const
    {
        return point (x + o.x, y + o.y);
    }

    point operator - (const point &o) const
    {
        return point (x - o.x, y - o.y);
    }

    T operator * (const point &o) const
    {
        return x * o.x + y * o.y;
    }

    point operator * (const T &coef) const
    {
        return point (x * coef, y * coef);
    }

    point ort () const
    {
        return point(-y,  x);
    }

    point rot (T alpha)
    {
        return *this * cosl(alpha) + ort() * sinl(alpha);
    }

    T len () const
    {
        return sqrtl(x * x + y * y);
    }

    T dist (const point &o) const
    {
        return (*this - o).len();
    }

    void print () const
    {
        cerr << x << ' ' << y << endl;
    }
};

void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
    int n, l;

    auto solve_test = [&] () {
        vector<ll> t(n);
        for (ll &x : t)
            cin >> x;

        t.resize(2 * n);
        for (int i = 0; i < n; i++)
            t[n + i] = t[i] + l;

        vector<point> circle(2 * n);
        vector<T> angle(2 * n);
        for (int i = 0; i < 2 * n; i++)
        {
            angle[i] = T(t[i]) * 2 * pi / T(l);
            circle[i] = point(cosl(angle[i]), sinl(angle[i]));
        }

        point ans;

        for (int i = 0; i < n; i++)
        {
            point sum_proj;
            for (int j = i + 1; j < i + n; j++)
            {
                if (j != i + 1) {
                    T ang = T(t[j] + t[i]) / T(l) * pi + pi;
                    auto center = point(cosl(ang), sinl(ang));
                    auto len = circle[i].dist(center);

                    point diff = circle[i] - center;
                    T rot_ang = atan2(diff.y, diff.x);
                    ans = ans + center * T(j - i - 1) + sum_proj.rot(rot_ang) * len;
                }

                {
                    const T ang = (T(t[j] - t[i]) * pi) / T(l);
                    sum_proj = sum_proj + point(cosl(ang), sinl(ang));
                }
            }
        }

        ans.print();
        const ll mltr = ll(n) * ll(n - 1) * ll(n - 2) / 2;
        ans = ans * (T(1) / T(mltr));
        return ans;
    };

    while (cin >> n >> l)
    {
        auto res = solve_test();
        cout << fixed << setprecision(15);
        cout << res.x << ' ' << res.y << endl;
//        break;
    }
}

void gen (stringstream &cout)
{
    mt19937 rng;
    const int n = 3000;
    const int l = int(1e9);
    cout << n << ' ' << l << endl;

    for (int i = 0; i < n; i++)
        cout << rng() % l << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cout << fixed;

#ifdef LOCAL
    //    {
//        auto st = clock();
//        stringstream test, out;
//        gen(test);
//        solve(test, out);
//        cout << "clock: " << setprecision(4) << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
//        return 0;
//    }

    auto st = clock();

    ifstream fin("../input.txt");

    solve(fin);

    cout << "clock: " << setprecision(4) << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
#else
    solve();
#endif

    return 0;
}

Measured memory_bytes: 640