// URL: https://yukicoder.me/problems/no/155 import std.algorithm, std.array, std.bitmanip, std.container, std.conv, std.format, std.functional, std.math, std.range, std.traits, std.typecons, std.stdio, std.string; version(unittest) {} else void main() { int N, L; io.getV(N, L); string[] st; io.getA(N, st); L *= 60; auto S = st.map!(sti => sti[0..2].to!int*60+sti[3..5].to!int).array; if (S.sum < L) io.put!"{exit: true}"(N); auto dp1 = new long[][][](N+1, N+1, L); dp1[0][0][0] = 1; foreach (i, Si; S) foreach (j; 0..N+1) foreach (k; 0..L) { dp1[i+1][j][k] = dp1[i][j][k]; if (j >= 1 && k >= Si) dp1[i+1][j][k] += dp1[i][j-1][k-Si]; } auto fact = Fact!(double, false)(N+1); auto r = 0.0, dp2 = new long[][](N+1, L); foreach (i, Si; S) { foreach (j; 0..N+1) foreach (k; 0..L) { dp2[j][k] = dp1[N][j][k]; if (j >= 1 && k >= Si) dp2[j][k] -= dp2[j-1][k-Si]; } foreach (j; 0..N) foreach (k; max(0, L-Si)..L) r += dp2[j][k]*fact[j+1]*fact[N-1-j]; } io.put(r/fact[N]); } struct Fact(T, bool inv = true) { int n; T[] table; alias table this; static if (inv) T[] invTable; pure nothrow @safe { this(int n) { this.n = n; table = new T[](n+1); table[0] = 1; foreach (i; 1..n+1) table[i] = table[i-1]*i; static if (inv) { invTable = new T[](n+1); invTable[n] = T(1)/table[n]; foreach_reverse (i; 1..n+1) invTable[i-1] = invTable[i]*i; } } } pure nothrow @nogc @safe { static if (inv) { T perm(size_t a, size_t b) in { assert(n >= a && a >= b); } do { return table[a]*invTable[a-b]; } T combi(size_t a, size_t b) in { assert(n >= a && a >= b); } do { return table[a]*invTable[b]*invTable[a-b]; } T homo(size_t a, size_t b) in { assert(n >= a+b-1); } do { return combi(a+b-1, b); } } } } auto io = IO!()(); import std.stdio; struct IO(alias IN = stdin, alias OUT = stdout) { import std.meta : allSatisfy; import core.stdc.stdlib : exit; void getV(T...)(ref T v) { foreach (ref w; v) get(w); } void getA(T)(size_t n, ref T v) if (hasAssignableElements!T) { v = new T(n); foreach (ref w; v) get(w); } void getC(T...)(size_t n, ref T v) if (allSatisfy!(hasAssignableElements, T)) { foreach (ref w; v) w = new typeof(w)(n); foreach (i; 0..n) foreach (ref w; v) get(w[i]); } void getM(T)(size_t r, size_t c, ref T v) if (hasAssignableElements!T && hasAssignableElements!(ElementType!T)) { v = new T(r); foreach (ref w; v) getA(c, w); } template getS(E...) { void getS(T)(size_t n, ref T v) { v = new T(n); foreach (ref w; v) foreach (e; E) mixin("get(w."~e~");"); } } const struct PutConf { bool newline = true, flush, exit; string floatFormat = "%.10f", delimiter = " "; } void put(alias conf = "{}", T...)(T v) { mixin("const PutConf c = "~conf~"; putMain!c(v);"); } void putB(alias conf = "{}", S, T)(bool c, S t, T f) { if (c) put!conf(t); else put!conf(f); } void putRaw(T...)(T v) { OUT.write(v); OUT.writeln; } private { dchar[] buf; auto sp = (new dchar[](0)).splitter; void nextLine() { IN.readln(buf); sp = buf.splitter; } void get(T)(ref T v) { if (sp.empty) nextLine(); v = sp.front.to!T; sp.popFront(); } void putMain(PutConf c, T...)(T v) { foreach (i, w; v) { putOne!c(w); if (i+1 < v.length) OUT.write(c.delimiter); } static if (c.newline) OUT.writeln; static if (c.flush) OUT.flush(); static if (c.exit) exit(0); } void putOne(PutConf c, T)(T v) { static if (isInputRange!T && !isSomeString!T) putRange!c(v); else static if (isFloatingPoint!T) OUT.write(format(c.floatFormat, v)); else static if (hasMember!(T, "fprint")) v.fprint(OUT); else OUT.write(v); } void putRange(PutConf c, T)(T v) { auto w = v; while (!w.empty) { putOne!c(w.front); w.popFront(); if (!w.empty) OUT.write(c.delimiter); } } } }