An automated packaging system is responsible for packing boxes. A box is certified to hold a certain weight. Given an integer total, calculate the number of possible ways to achieve total as a sum of the weights of items weighing integer weights from 1 to k, inclusive.
Example
total= 8
k=2