It might help to draw out a probability tree. Check out the diagram below. The first two branches at the top represent bags A and B. The probability of picking either bag is 1/2 assuming each bag is equally likely to be picked.
If we go with bag A, then the probability of getting blue is 3/11 since there are 3 blue out of 8+3 = 11 total. The probability of getting bag A and a blue marble is (1/2)*(3/11) = 3/22 which I've marked in the diagram as well.
If we go with bag B, then the probability of getting blue is 7/12 since there are 7 blue out of 5+7 = 12 total. The probability of getting bag B and blue is (1/2)*(7/12) = 7/24
Add up the results found getting
P(blue) = P(blue & bag A) + P(blue & bag B)
P(blue) = 3/22 + 7/24
P(blue) = 36/264 + 77/264
P(blue) = 113/264
This is shown in the diagram as well.
--------------------------------------------------
Recall that conditional probability in general is defined as follows
P(A given B) = P(A and B)/P(B)
In this problem, we'll have
P(bag B given blue) = P(bag B and blue)/P(blue)
Therefore, we can say...
P(bag B given blue) = P(bag B and blue)/P(blue)
P(bag B given blue) = (7/24)/(113/264)
P(bag B given blue) = (7/24)*(264/113)
P(bag B given blue) = (7*264)/(24*113)
P(bag B given blue) = (7*24*11)/(24*113)
P(bag B given blue) = (7*11)/(113)
P(bag B given blue) = 77/113
In short, the probability of getting bag B, given the marble is blue, is 77/113.