I started a response today then got interrupted.
I think there is a matter of taste - the M optical designs and coatings are different from the K - not necessarily conditional, just different.
Some K lenses are clearly the best at their FL Pentax ever made, at least in MF.
Same could be said for some M lenses and A lenses.
There is the subjective. Some people favor bokeh, some sharpness - that leads to different opinions.
There is the tactile pleasure of using a lens. Some people care about that, some don't. Generally, tactile people order the lens lines Takumars best, K next, M next, A can be great or not, F/FA generally pretty unpleasant in manual shooting.
A Canadian named J. Colwell consolidated the opinion first posted on the internet in the late 90's through 2005 and ranked (
SPLOSdb.pdf) the Pentax lenses from Tak through the FA's then available. His consolidation of then-current opinion of the outstanding (!) non-* MF lenses was:
K18/3.5
M28/2
K28/3.5
K28/3.5 Shift
K35/3.5
A50/1.4
A50/1.7
K85/1.8
K135/2.5
K200/2.5
The next level (merely Excellent) contains virtually every other lens discussed in this thread. None of this is to say K is better than M generally, but that the best MF lens for a given FL is often the K series. In my limited experience the difference is often (but not always)
de minimus.
This ranking purported to consolidate opinion from a number of sources and was specifically NOT driven by his own opinion. Take all of this with some salt - the FA77 Ltd was not ranked Outstanding (!) - merely Excellent ** - and shoot what you like the best!!