Measurement of the centrality dependence of J/psi yields and observation of Z production in lead-lead collisions with the ATLAS detector at the LHC