Not quite sure what you are wanting exactly. Whether you want the black or the white from A. But if you put B on Layer 1, place A on layer 2. Resize layer 2, since they are different sizes. Then select transfer mode - Multiply to leave the black, or screen to leave the white. Darken and Add both work as well, but I prefer Multiply and Screen.
Hope that's what you were looking for!