Well depends on the adapter too. You can by the proper adapters from chinese ebayers. You just need to know which ones to look for.
Pentax specifically designed the KMount with the M42 Mount in mind and so both types of lenses have the same flange (lens mount to film) distance. That adapter you bought extends the length of the lens but like 1mm and enough to make your camera 'farsighted'.
A genuine Pentax and a third party M42-Kmount adapter.
3rd party adapter on the camera. Notice how the adapter sits 'flush' with the K Mount Plate?
Just remember the design when you are looking for adapters and don't buy the fat doughnut types that are like yours. You don't need the genuine pentax adapter. Alot of other places sell
generic ones like B&H. You can also find the proper M42-K adapters around on ebay like some Russian stores have them, Roxsen (HK based) etc.