which ever "M" address returns the same "3" address that the coins were sent to in the transaciton is the one you need to have the private key for in your wallet in order to redeem the coins...otherwise you need the "redeemscript for the multisig address if it was a multisig wallet that made the segwit transaction...
whoever told whoever to send the coins to the "3" address is the one who ran addwittness on the "L" address to get the "3" address in the first place because that is the only way to get the inital "3" address for the transaction to have occurred.
in order to obtain a "3" address in core you run addwitness(L address) or addwitness(M address)
and it returns a 3 address
if you run addwitness on an M address then you are running addwitness on a multisig address...which is another type of P2SH address...
who ever made the 3 address was who ever made the "M" address (multisig address)
and when you create a multisig address you get back a "redeemScript"
know you have the correct initial "L' address right?
open console and type:
addmultisig 1 (L address)
and if you get the same "M" address" back then you are the one who created the multisig address initally
P2SH address' refer to transactions is all they do...the coins are unlocked with P2SH but are still actually in the Initial L address that created the P2SH address...just the L address released the transaction to the P2SH(segwit or multisig) address as a key on the blockchain and you use a redeemScript to tell the wallet that you are the one aloud to access the coins with that P2SH address(segwit or multisig) and the redeemscript
you must have the same private public key pair in your wallet belonging to the "L" address that created the "M" address which created the P2SH address(segwit or multisig)
try running this in console:
and see if all your unspent outputs add up to the balance you see in your wallet