Shil and Lab Assignment
Tag(s):

## Graph, Matching, Mathematics, Medium

Problem
Editorial
Analytics

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:

• 1N103
• 1Ai105
• NM105
SAMPLE INPUT
5 8
16
2
4
1
32
SAMPLE OUTPUT
4
Explanation

Some of the possible assignments are [8,2,4,1,5] , [8,2,4,1,6] or [7,2,4,1,8]

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in Challenge Name

October Circuits

OTHER PROBLEMS OF THIS CHALLENGE
• Basic Programming > Implementation
• Math > Combinatorics
• Algorithms > Graphs
• Algorithms > Graphs
• Algorithms > Graphs
• Math > Basic Math