To figure this out, you should think about the multiples of 10 boxes you could have.
If I had 10 small boxes, there would need to be 86 large boxes. 86 is not evenly divisible by 8 so that doesn't work.
If I had 20 small boxes, there would be 76 large boxes. 76 is not evenly divisible by 8.
If I had 30 small boxes, there would be 66 large boxes. 66 is not evenly divisible by 8.
If I had 40 small boxes, there would be 56 large boxes. 56 is every divisible by 8.
4 cartons of 10 small boxes and 7 cartons of 8 large boxes would be needed. This is a total of 11 cartons.