invariant packing bin

We are given an array of whole numbers and a number K. We need to package these whole numbers in containers. The condition is that we have to use exactly the K number of containers and each one must have the same capacity. We need to find the size of the container in such a way that the waste of the unused container is minimized.

Is this problem solvable polynomial time?