State tax filing

you prepare your federal return including the W-2, Federal K-1 for VA and Federal K-1 for MD

Since MD is a loss you can next prepare your VA return which would include the MD loss. VA starts out with Federal AGI so the MD loss should already be included. MD may allow a net operating loss carryforward in which case filing there as a nonresident would be crucial should there be MD income in the future. others more familiar with MD taxes may advise you further