#include #include using namespace std; using namespace atcoder; #define rep(i, n) REP(i, 0, n) #define REP(i, s, e) for (ll i = (s); i < (ll)(e); i++) #define repr(i, n) REPR(i, n, 0) #define REPR(i, s, e) for (ll i = (ll)(s - 1); i >= (ll)(e); i--) #define all(r) r.begin(), r.end() #define rall(r) r.rbegin(), r.rend() typedef long long ll; typedef vector vi; typedef vector vl; template bool chmax(T& a, const U& b) { if (a >= b) return false; a = b; return true; } template bool chmin(T& a, const U& b) { if (a <= b) return false; a = b; return true; } void yes_no(bool f, string yes = "Yes", string no = "No") { cout << (f ? yes : no) << "\n"; } void solve() { int n, m; cin >> n >> m; m *= 60; vector a(n); rep(i, n) { int x, y; char c; cin >> x >> c >> y; a[i] = x * 60 + y; } ll sum = accumulate(all(a), 0); if (sum <= m) { cout << n << '\n'; return; } using D = long double; vector f(n + 10); f[0] = f[1] = 1; REP(i, 2, n + 10) f[i] = f[i - 1] * i; const int ma = 2.5e4; vector> dp(ma + 1, vector(n + 1)); dp[0][0] = 1; rep(i, n) repr(x, i + 1) rep(y, ma) { dp[min(ma, (int)y + a[i])][x + 1] += dp[y][x]; } vector ep(ma + 1, vector(n + 1, 0LL)); D ans = 0; rep(i, n) { rep(x, n + 1) { rep(y, m + a[i]) { ep[y][x] = dp[y][x]; if (y >= a[i] && x > 0) ep[y][x] -= ep[y - a[i]][x - 1]; if (x < n && y < m) ans += ep[y][x] * f[x] * f[n - x - 1]; } } } ans /= f[n]; cout << fixed << setprecision(15); cout << ans << "\n"; } int main() { cin.tie(0); ios::sync_with_stdio(false); int t = 1; // multi-testcase // cin >> t; rep(ti, t) solve(); return 0; }