Numbers are 2 and 2.
A would have got 4, which means 1+3 or 2+2. so that’s why he was not sure of the numbers.
B would have also got 4, possibilities 1*4 and 2*2.
Now, had the numbers be 1 and 3, B would have got 3 and he would have been sure of the numbers, but that was not the case, So A became sure that numbers are 2 and 2.
Now, B knows that numbers cant be 1 and 4, because there are two possibilities of getting the sum as 5, 1+4, 2+3, and in both these cases A cant guess the number depending on B’s earlier answer, as for both product 4 and 6 there are more than 1 possibilities.
Thus B also knows that the numbers are 2 and 2.