The question asks for the least number of each bags to be filled for filling a total of 156 apples.
Now one thing is clear that of we fill 6 apples bag first , then the number of bags will not be the least , it will increase because firstly we are filling the bag which can hold less number of apples,
So first we start filling the 9 bag apples
Now we know that
16* 9 = 144 and
17 * 9 = 153
If we fill 17 large bags , we are left with 3 apples , while the question says we have to fill the bags completely
It means we can stop at 16 large bags
and then we will be left with 156 - 144 = 12 apples
which can completely fit in 2 small bags
So answer is 16 large bags and 2 small bags