As the conductor B carrying a charge +q inserted in the cavity, the charge -q is induced on the metal surface of the cavity and them charge + q induced on the outside surface of the conductor A. Initially the outer surface of A has a charge Q and now it has a charge +q induced. So the total charge on the outer surface of A is `Q+q`.