Let here are n processes in the system and each one needs k instances of a resources to complete. Then the minimum number of resources that you should keep in the system to ensure no deadlock in the system is n*k-n+1 , where n*k = sum of all resources.
its like n*k-n resources are required so that each process can have one less than the resource instance they require.. but still deadlock can occur as each process depend upon other process for one resource instance ..if we provide n*k-n+1 resource instances than the deadlock condition will never occur.
so use this formula here , here n =5 , n*k = 23+35+12+43+15 = 128
so n*k-n+1 = 128-5+1= 123 +1= 124