The number of ways to distribute 10 identical balls into 5 distinguishable boxes is often solved using the “stars and bars” technique. Ten stars represent the balls, and four bars represent the dividing points between the first and second, second and third, third and fourth, and fourth and fifth boxes.
Thus the arrangement of 10 *s and 4 bars **|*****||*|** represents putting 2 balls in the first box, 5 in the second box, none in the third box, one in the fourth box, and two in the fifth box.
An arrangement where the total of balls in the first two boxes is 6 must have six *s and one | before the second | (which separates the first two boxes from the last three). The second | is therefore the 8th symbol in the arrangement.
So you need to count the arrangements of 10 *s and 4 bars that have the pattern [any arrangement of six *s and one 1] | [any arrangement of four *s and two bars].