We compute exactly the covariance between the maximum M and the number of records K in a discrete time series of n entries as a quantitative probe of the history leading to an extreme event. For continuous IID series, with a common probability distribution function (PDF) p(x), we find the striking result that M and K are uncorrelated for any n≥1. We show that this independence is rather fragile and the covariance Cq(n) between M and K becomes nonzero when p(x) becomes discontinuous due to a delta-component at x=0 with an amplitude 0<q<1. This time series models the occurrence of dry days with probability q in a precipitation time series when there is no rainfall. We show that there is an interesting shape transition at a critical value qc where the covariance Cq(n), as a function of n, changes from monotonic (qqc). We compute the critical strength qc exactly. Furthermore, for large n, we show that Cq(n) decays as a power law, with an exponent that depends on the tail of p(x). We then compare our theoretical predictions with real precipitation data from several weather stations across Germany, finding a very good agreement.