Appropriate method to calculate remaining licenses on account

I found a -1 example, there were a lot of logs to dig through.