#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int v, w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int INF = INT_MAX / 4; int main() { int N, L; cin >> N >> L; L *= 60; int l = L + 3600; vector a(N); for (int i = 0; i < N; i++) { int MM, SS; scanf("%d:%d", &MM, &SS); a[i] = MM * 60 + SS; } vector > dp(N + 1, vector(l)); dp[0][0] = 1; for (int i = 0; i < N; i++) { vector > _dp(N + 1, vector(l)); for (int j = 0; j <= i; j++) for (int k = 0; k < l; k++) { _dp[j][k] += dp[j][k] * (i - j + 1) / (i + 2); if (k + a[i] < l) _dp[j + 1][k + a[i]] += dp[j][k] * (j + 1) / (i + 2); } dp = _dp; } double sum = 0; for (int i = 0; i < N; i++) { vector > x(N + 1, vector(l)); for (int j = 0; j <= N - 1; j++) for (int k = 0; k < L; k++) { if (j == 0 || k < a[i]) x[j][k] = dp[j][k] / (N - j) * (N + 1); else x[j][k] = (dp[j][k] - x[j - 1][k - a[i]] * j / (N + 1)) / (N - j) * (N + 1); sum += x[j][k]; } } printf("%.10f\n", sum); }