Yes, the thread mount versions (M42) are compatible with older Pentax cameras using the same mount, the K-mount versions are will fit newer Pentax cameras.
You can easily distinct them by the name:
e.g. Helios 44M-4 is M42 screw mount
https://www.pentaxforums.com/userreviews/data/83/K5JH4306.jpg
Helios 44K-4 is the K-mount version.
https://www.pentaxforums.com/userreviews/data/83/1111.jpg
Therer are also adapters to use screw mount lenses on K-mount bodies.
Mind that older screw mount versions of Pentax cameras might not support automatic lenses (the ones with a pin that moves the aperture). You can easily determine that by looking into the camera with the lens removed. If there is a crescant shaped lever on the bottom side of the the opening it will support automatic lenses.
If not you need either a preset lens Helios up to version 44-2 or one that can be switched between A/M like the Helios 44-3. These older versions exist only in M42 screw mount.
Hope this helps and have fun using your Pentax film camera
參考: using quite a few different film cameras, Zenit and Pentax among them