1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <bits/stdc++.h>
using namespace std;
#define rep(a, b) for (int a = 0; a < (b); a++)
#define rep1(a, b) for (int a = 1; a <= (b); a++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;

#define LOCAL false

const int LIM = 50007;
int n, T;

using fp = double;

const fp EPS = 1e-25;
const int START = 150;
const int SPREAD = 150;

fp probs[LIM];
fp dp[2][2*LIM];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if (LOCAL) {
        ignore=freopen("io/in", "r", stdin);
        ignore=freopen("io/out", "w", stdout);
    }

    cin >> n >> T;
    rep(i, n) cin >> probs[i];
    sort(probs, probs+n, greater{});

    int x = 0;
    dp[x^1][LIM+0] = 1;

    fp maxp = 0;
    fp avgpts = 0;
    rep(i, n) {
        fp p = probs[i];
        avgpts += -1+2*p;

        int timer;
        int mid = int(avgpts)/2*2+((i+1)%2);
        if (i < START) {
            for (int t = max(-n, mid); t <= n; t+=2) dp[x][LIM+t] = dp[x^1][LIM+t-1]*p + dp[x^1][LIM+t+1]*(1-p);
            for (int t = min(n, mid-2); t >= -n; t-=2) dp[x][LIM+t] = dp[x^1][LIM+t-1]*p + dp[x^1][LIM+t+1]*(1-p);
        } else {
            timer = -1;
            for (int t = max(-n, mid); t <= n && timer; t+=2) {
                dp[x][LIM+t] = dp[x^1][LIM+t-1]*p + dp[x^1][LIM+t+1]*(1-p);
                if (dp[x][LIM+t] < EPS && timer == -1) timer = SPREAD;
                if (timer > 0) timer--;
            }
            timer = -1;
            for (int t = min(n, mid-2); t >= -n && timer; t-=2) {
                dp[x][LIM+t] = dp[x^1][LIM+t-1]*p + dp[x^1][LIM+t+1]*(1-p);
                if (dp[x][LIM+t] < EPS && timer == -1) timer = SPREAD;
                if (timer > 0) timer--;
            }
        }

        fp curp = 0;
        int minT = T + ((T&1)==(i&1));
        timer = SPREAD;
        for (int t = minT; t <= n && timer; t+=2) {
            curp += dp[x][LIM+t];
            if (dp[x][LIM+t] > EPS) timer = SPREAD;
            else timer--;
        }
        maxp = max(maxp, curp);
        x^= 1;
    }
    x ^= 1;
    cout << fixed << setprecision(7) << maxp << "\n";

    return 0;
}