Welcome to HP support community.
Try the steps mentioned in this HP document to fix paper jam issue:- Click here
After fixing the paper jam issue, update the printer firmware
Here are the steps:- Click here
Then create a custom paper size to print on B5 paper size:- Click here
I hope that helps.
To thank me for my efforts to help you, please mark my post as an accepted solution so that it benefits several others.
Cheers.