Welcome to the forums!
To shoot with your 40mm lens, you need to find the setting "Enable Aperture Ring" in your menu. Then you can use the M (Manual) setting, and use the green button to meter prior to shooting. The nice people in this forum even created a video showing how to do it:
The good news is that this will work even with your K-50 that has the aperture motor problem! It can still work with lenses where you set the aperture in the aperture ring. You can turn it into a body for manual lenses, in case you don't want to have it fix or fix it yourself.