#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;

using my_float = double;

struct point {
    my_float x, y;

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

    point(my_float _x, my_float _y) : x(_x), y(_y) {}

    point& operator+=(const point &other) { x += other.x; y += other.y; return *this; }
    point& operator-=(const point &other) { x -= other.x; y -= other.y; return *this; }
    point& operator*=(my_float mult) { x *= mult; y *= mult; return *this; }

    point operator+(const point &other) const { return point(*this) += other; }
    point operator-(const point &other) const { return point(*this) -= other; }
    point operator*(my_float mult) const { return point(*this) *= mult; }

    // Warning: does exact floating-point comparisons.
    bool operator==(const point &other) const { return x == other.x && y == other.y; }
    bool operator!=(const point &other) const { return !(*this == other); }

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

    my_float norm() const {
        return x * x + y * y;
    }

    my_float dist() const {
        return sqrt(norm());
    }

    bool top_half() const {
        return make_pair(y, x) > pair<my_float, my_float>(0, 0);
    }

    friend ostream& operator<<(ostream &stream, const point &p) {
        return stream << '(' << p.x << ", " << p.y << ')';
    }
};

my_float cross(const point &a, const point &b) {
    return a.x * b.y - b.x * a.y;
}

my_float dot(const point &a, const point &b) {
    return a.x * b.x + a.y * b.y;
}

bool left_turn_strict(const point &a, const point &b, const point &c) {
    return cross(b - a, c - a) > 0;
}

bool left_turn_lenient(const point &a, const point &b, const point &c) {
    return cross(b - a, c - a) >= 0;
}

// Warning: does a floating-point comparison to exactly 0.
bool collinear(const point &a, const point &b, const point &c) {
    return cross(b - a, c - a) == 0;
}

// Returns twice the signed area formed by three points in a triangle. Positive when a -> b -> c is a left turn.
my_float area_signed_2x(const point &a, const point &b, const point &c) {
    return cross(b - a, c - a);
}

my_float distance_to_line(const point &p, const point &a, const point &b) {
    assert(a != b);
    return abs(area_signed_2x(p, a, b)) / (a - b).dist();
}

my_float manhattan_dist(const point &a, const point &b) {
    return abs(a.x - b.x) + abs(a.y - b.y);
}

my_float infinity_norm_dist(const point &a, const point &b) {
    return max(abs(a.x - b.x), abs(a.y - b.y));
}

// Sort in increasing order of y, with ties broken in increasing order of x.
bool yx_compare(const point &a, const point &b) {
    return (b - a).top_half();
}

// Sort in increasing order of angle to the x-axis.
bool angle_compare(const point &a, const point &b) {
    if (a.top_half() ^ b.top_half())
        return a.top_half();

    return cross(a, b) > 0;
}


const my_float PI = acos((my_float) -1);

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

    int N, L;
    cin >> N >> L;
    vector<int> T(N);
    vector<my_float> angle(N);

    for (int i = 0; i < N; i++) {
        cin >> T[i];
        angle[i] = 2 * PI * T[i] / L;
    }

    point sum(0, 0);

    for (int i = 0; i < N; i++)
        for (int j = i + 1; j < N; j++) {
            int mult = N - 2 * (j - i);
            my_float mid = (angle[i] + angle[j]) / 2;
            sum += point(cos(mid), sin(mid)) * mult;
        }

    my_float choose3 = (my_float) N * (N - 1) * (N - 2) / 6;
    sum *= 1 / choose3;
    cout << setprecision(15);
    cout << sum.x << ' ' << sum.y << '\n';
}


Measured memory_bytes: 256