For the lab assignment of this week , Shil got N numbers A1 , A2, ... AN. He must assign each of these numbers a unique integer value from 1 to M. Let Ci be the integer assigned to Ai . Shil must assign numbers in such a way that maximum number of Ai are divisible by their Ci . You must print maximum numbers of Ai that could be made divisible by Ci in optimal assignment.
Input:
First Line of input consists of integer N and M.
Next N lines consists of N integers with ith line containing integer Ai.
Output:
Output maximum number of Ai that can be made divisible by Ci in optimal assignment.
Constraints:
- 1 ≤ N ≤ 103
- 1 ≤ Ai ≤ 105
- N ≤ M ≤ 105
Some of the possible assignments are [8,2,4,1,5] , [8,2,4,1,6] or [7,2,4,1,8]
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor