WC '15 Contest 4 J1 - Telling Time

View as PDF

Points: 3
Time limit: 3.0s
Memory limit: 16M

Author:
Problem type
Woburn Challenge 2015-16 Round 4 - Junior Division

James Bond is preparing to embark on a particularly dangerous mission – catching ruthless Canadian ice wine smugglers. He'll be attending a secret (but elegant) wine tasting party at the smugglers' hideout, with the intention of causing a huge distraction and sneaking further into their lair. If only there were a way to suddenly disrupt the wine tasting process for all of the guests...

Fortunately for Bond, Q has an idea. According to his research, the glass which the wine glasses are made of has a resonance frequency of Hz. If a loud noise were to be emitted in the room, with a frequency which is an exact multiple of the glass's resonance frequency, the wine glasses could be made to all shatter at once, giving Bond just the kind of distraction he'll need!

Q has developed fancy watches for this mission. Aside from helping Bond look the part of a rich wine collector (and be able to tell the time), the watches have powerful auditory emitters embedded within them! The -th watch can emit noise at a frequency of Hz.

Though all watches can keep time accurately, only the ones with frequencies which are exact multiples of Hz will be of use to Bond for this mission. Please help Q count how many of his watches he could potentially give to Bond!

Input Specification

The first line of input consists of two space-separated integers and .
The next lines each consist of a single integer , for .

Output Specification

Output a single integer – the number of watches which are able to break the glass.

Sample Input

4 2000
6000
1000
2000
20001

Sample Output

2