Candy Factory
시간 제한1초메모리 제한2048 MB
n개 종류의 사탕 개수가 주어질 때, 정확히 k가지 종류로 이루어진 묶음으로 남김없이 나누도록 더해야 하는 최소 사탕 개수를 구한다.
문제
The International Consortium of Popular Candies (ICPC) is hosting a prestigious candy festival for candy lovers worldwide. The consortium has asked candy factories to produce candies for the event. Each of the factories has produced some quantity of a unique type of candy.
Packs of candies will be given to the participants at the festival. A candy pack must consist of exactly candies of different types. Two candy packs may contain different sets of candies.
There may be unavoidably some leftover candies given the quantities of candies that the factories have already produced. The ICPC does not want to waste any of the candies produced, and is willing to create extra packs of candy to ensure this. The ICPC can order any of the factories to produce additional candies. What is the minimum quantity of additional candies that must be ordered, so that there will be no leftover candies after packing?
입력
The first line of input has two integers and ().
The next lines each have a single integer between and . The integer on the line is the quantity of candies that the factory has produced.
출력
Output a single integer, the minimum quantity of additional candies that must be ordered.