Valence-quark distribution functions in the kaon and pion