Mark the Federal Info Worksheet that you have nonresident taxes for PA. Complete the nonresident Worksheet linked there after you complete the 1040. Prepare the PA tax return. Then prepare the MD tax return. It will automatically pick up income tax paid to PA (or any other state) and prepare the 502CR for you. Remember, you must attach to the MD 502 a PDF of the PA tax return before e-filing.