In the worst case for process completion, it should be that each process must hold one less resource than its peak demand. That is processes $A,B,C,D$ and $E$ must be holding $4,6,8,2$ and $7$ number of resources and if no more free resource is there, we have a deadlock. i.e., if the total number of resources is less than or equal to $4+6+8+2+7 = 27$ we can have a deadlock. But there is a further restriction that processes $A$ and $B$ together can hold maximum $8$ resources at a time. This means instead of $4+6$ we added we must do just $8.$ This means, only if the total number of resources is less than or equal to $27 - 10+8 = 25,$ there can be a deadlock.