The mass of the top quark is measured using a sample of $\mathrm{t\overline{t}}$ events containing one isolated muon or electron and at least four jets in the final state, collected by the CMS detector using proton-proton collisions at $\sqrt{s}=$ 13 TeV at the CERN LHC. The events are selected from data corresponding to an integrated luminosity of 35.9 fb$^{-1}$. For each event the mass is reconstructed from a kinematic fit of the decay products to a \ttbar hypothesis. Using the ideogram method, the top quark mass is determined simultaneously with an overall jet energy scale factor (JSF), constrained by the mass of the W boson in $\mathrm{q\overline{q}'}$ decays. The measurement is calibrated on samples simulated at next-to-leading order m...