For any M42 lens you need an adapter.
If you plan to change the adapter, i.e. if you want to use 1 adapter for few or more M42 lenses, then for sure the original Pentax K-M42 (old name 30120) adapter.
It is the best and machined very precise but expensive.
There are chinese copies, they look almost the same. Make sure it is stainless steal and not aluminium because the latter often cracks open.
The Pixco is pretty well made:
https://images-na.ssl-images-amazon.com/images/I/51Pdak4u9fL._AC_SL1000_.jpg...ntaxforums-20&
I prefer the adapter to stay on my M42 lenses so I can use them like K-lenses.
For my precious M42 lenses such as the Takumar 50/1,4 8-Element I use the original.
For cheaper ones I use the Chinese copies.
I take the little spring off, screw the adapter very tight onto the lens and then screw this tiny screw which held the spring back and thus tighten the adapter with this screw as well.
Doing so I never had any problems and I know many who do it similar.
There are those M42 adapters sometimes sold on ebay or amazon which do not allow infinity focus, they look like those ones:
M42 Adapter to Pentax K for K-r, K-5, K-7, K-x, K-7: Amazon.co.uk: Camera & Photo amazon.com: FOTGA Lens Mount Adapter for M42 Mount Lens to Pentax PK K Mount Camera K-S2 K-1 K-3II K-70 K-P: Electronics?tag=pentaxforums-20&
Those must be used if your M42 lens with the normal adapter would be to small in diameter and thus light could enter and ruin any photo.
I had this once only. They exist for this very reason and also for M42 macro-lenses where infinity is not needed.
So one just must know which adapter is for which lens.
The best solution of course is this one (German language but photos are good to show how it's done):
[Tutorial] M42 auf "Pentax K" umbauen ? Pentaxians
As you have to register to see the photos, here the link to them:
http://h2097500.stratoserver.net/forumimages/2017/5274/5274_2017090303_img2946.jpg http://h2097500.stratoserver.net/forumimages/2017/5274/5274_2017090308_img2948.jpg http://h2097500.stratoserver.net/forumimages/2017/5274/5274_2017090310_img2949.jpg http://h2097500.stratoserver.net/forumimages/2017/5274/5274_2017090312_img2950.jpg http://h2097500.stratoserver.net/forumimages/2017/5274/5274_2017090315_img2954.jpg