#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

int main(){
    using namespace std;
    using long_decimal = boost::multiprecision::cpp_dec_float_100;
    long_decimal pi = boost::math::constants::pi<long_decimal>();
    unsigned long N, L;
    cin >> N >> L;
    vector<unsigned long> T(N);
    copy_n(istream_iterator<unsigned long>(cin), N, T.begin());
    long_decimal x{0}, y{0};
    for(long i = 1; i < N; ++i){
        for(long j = 0; j < i; ++j){
            auto c = T[i] + T[j];
            long t = N + 2 * (j - i);
            x += t * boost::multiprecision::cos(pi * c / L);
            y += t * boost::multiprecision::sin(pi * c / L);
        }
    }
    unsigned long t = N * (N - 1) * (N - 2) / 6;
    x /= t;
    y /= t;
    cout << x.str(20, std::ios_base::fixed) << " " << y.str(20, std::ios_base::fixed) << endl;
    return 0;
}