A search for a standard model Higgs boson produced in association with a top-quark pair and decaying to bottom quarks is presented. Events with hadronic jets and one or two oppositely charged leptons are selected from a data sample corresponding to an integrated luminosity of 19.5fb-1 collected by the CMS experiment at the LHC in pp collisions at a centre-of-mass energy of 8TeV. In order to separate the signal from the larger tt¯ + jets background, this analysis uses a matrix element method that assigns a probability density value to each reconstructed event under signal or background hypotheses. The ratio between the two values is used in a maximum likelihood fit to extract the signal yield. The results are presented in terms of the measured signal strength modifier, μ, relative to the standard model prediction for a Higgs boson mass of 125GeV. The observed (expected) exclusion limit at a 95 % confidence level is μ<4.2 (3.3), corresponding to a best fit value (Formula presented.).