  This paper focuses on hadron mass effects in calculations of semi-inclusive
kaon production in lepton-Deuteron deeply inelastic scattering at HERMES and
COMPASS kinematics. In the collinear factorization framework, the corresponding
cross section is shown to factorize, at leading order and leading twist, into
products of parton distributions and fragmentation functions evaluated in terms
of kaon- and nucleon-mass-dependent scaling variables, and to respect gauge
invariance. It is found that hadron mass corrections for integrated kaon
multiplicities sizeably reduce the apparent large discrepancy between
measurements of $K^+ + K^-$ multiplicities performed by the two collaborations,
and fully reconcile their $K^+/K^-$ ratios.
