Pentax ME, ME Super, and P3/5/30/50 are nowadays famous for this error, if they have not been used for long periods of time. With these it is known to be a mechanical error which can be fxed with CLA. As the film transport/shutter technology of the P series is the same as for the A (as far as I know), I would think it is the same kind of error.
Here you can see you are not the only one:
https://www.pentaxforums.com/forums/pentax-film-slr-discussion/151639-super-p...ter-issue.html
And if the mechanics involved are similiar to the P5, this thread may help to understand (or even to fix it):
https://www.pentaxforums.com/forums/pentax-beginners-corner-q/217940-i-think-...uite-sure.html