As tybeck says, all K mount lenses will fit without adapter, that is one of Pentax major strength's, backward compatibility like no one else. M42 leses will fit with a very simple adapter. Make sure you get the original one or one of the 3rd party adapters that allow infinity focus. Those who make m42 adapters for other mounts, like Nikon F, where it is impossible to mount a m42 lens with infinity focus, fill ebay with m42-K mount adapters built in the same way that dissable infinity focus.
If you are interrested in mounting other lenses than K and m42 on your K mount Pentax, there are adapters for quite many other mounts: Canon FD/FL/FT, Nikon F, Topcon RE/Exacta, Leica R, Voigtländer/Kodak Retina DKL and several medium format lenses. I tried to make a complete list at:
https://www.pentaxforums.com/forums/camera-studio-accessories/96884-adapters-...addiction.html