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
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (auto i=(a); i<(b); i++)
#define FORD(i, a, b) for (auto i=(a); i>(b); i--)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif

const int maxN = 1 << 16;

long double mass[maxN];

void solve()
{
	int m, t;
	scanf ("%d%d", &m, &t);
	std::vector <long double> P;

	while (m--)
	{
		long double x;
		scanf ("%Lf", &x);
		if (x == 1.0)
			t--;
		else
			P.push_back(x);
	}

	sort(ALL(P), std::greater <long double>());
	long double res = 0;
	mass[0] = 1.0;

	if (t <= 0)
		res = 1.0;
	
	else FOR(n, 1, SZ(P)+1)
	{
		auto p = P[n-1], q = 1.0 - p;

		FORD(k, n, 0)
			mass[k] = mass[k] * q + mass[k-1] * p;
		mass[0] *= q;

		long double cur = 0;
		FOR(k, (n+t+1)/2, n+1)
			cur += mass[k];
		res = std::max(res, cur);
	}

	printf("%.9Lf\n", res);
}

int main()
{
	int tc = 1;
//	scanf ("%d", &tc);	
	FOR(cid, 1, tc+1)
		solve();
	return 0;
}