Storage Keepers

Randy Company has N (1 ≤ N ≤ 100) storages. Company wants some men to keep them safe. Now there are M (1 ≤ M ≤ 30) men asking for the job. Company will choose several from them. Randy Company employs men following these rules:

  1. Each keeper has a number Pi (1 ≤ Pi ≤ 1000) , which stands for their ability.
  2. All storages are the same as each other.
  3. A storage can only be lookd after by one keeper. But a keeper can look after several storages. If a keeper’s ability number is Pi, and he looks after K storages, each storage that he looks after has a safe number Uj = Pi ÷ K.(Note: Uj, Pi and K are all integers). The storage which is looked after by nobody will get a number 0.
  4. If all the storages is at least given to a man, company will get a safe line L = min Uj
  5. Every month Randy Company will give each employed keeper a wage according to his ability number. That means, if a keeper’s ability number is Pi, he will get Pi dollars every month. The total money company will pay the keepers every month is Y dollars. Now Randy Company gives you a list that contains all information about N, M, P, your task is give company a best choice of the keepers to make the company pay the least money under the condition that the safe line L is the highest. Input The input file contains several scenarios. Each of them consists of 2 lines: The first line consists of two numbers (N and M), the second line consists of M numbers, meaning Pi (i = 1..M). There is only one space between two border numbers. The input file is ended with N = 0 and M = 0. Output For each scenario, print a line containing two numbers L(max) and Y (min). There should be a space between them. Sample Input 21 7 12 10 9 25 10 8 6 4 1 54 1111 00

2/2 Sample Output 37 10 10 8 18 00