It looks like the focus ring isn't attached in the right place. The front barrel on your lens is sticking out about the right amount for infinity - or at least, a lot farther away than infinity. If you still can, send it back and get a refund.
Back in my day
, the sellers would just laugh at the idea of a refund, so I learned to fix these myself. Turn the focus ring as far as you can towards infinity, without forcing it at all. You need something to unscrew the front trim ring that says SMC Pentax-M 1:1.7 50mm etc. Something rubber will work, like a chair leg protector, large rubber stopper, etc. Just make sure it doesn't touch the front element. The ring unscrews through the filter threads. Then your lens will look like this:
Use a #00 screwdriver to remove the screws marked with red arrows, leaving the ones in cutouts alone. Now you can take off the filter ring/front barrel and see this:
There should be three screws on your lens like the ones marked with red arrows. Loosen all three and the focus ring should turn without focusing the lens at all. It has two mechanical stops to keep it from rotating completely around but it should turn freely. Turn the focus ring until it points at the infinity mark. Then tighten one screw.
Now you need to set infinity more precisely. I think your lens is probably focusing slightly beyond infinity right now. Mount it on a camera and try to focus on something several miles away, the furthest thing you can see. If I'm right, you'll have to turn the focus ring back to maybe the 25 foot mark. When you're happy with the focus, loosen the one tight screw, turn the focus ring so the center of the infinity symbol lines up with the orange diamond, then tighten all three screws.
Optional maintenance: Some of these lenses are dirty inside so I usually have an old toothbrush handy to brush out debris. Then I'd check to see if the aperture is fully open at f1.7. You shouldn't see any of the aperture blades. If you want to adjust this, set the aperture ring to f1.7 and loosen the three screws that were in cutouts in the first photo. Then you can rotate the whole optical assembly. If you turn it one way, the blades disappear. Rotating the other way makes the blades stop down further. Rotate the assembly until the blades just disappear, then tighten the screws. Check to see if they continue to stop down at each position on the aperture ring. Then tighten all the screws.
Now you can reinstall the filter ring and trim ring and start using the lens.