Elections
InterviewTime limit2sMemory limit1024 MB
Count the ballots numbered 1 to n that are not divisible by any of the k chosen numbers.
- Level
Easy3 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Statement
Virtlandia holds a presidential election once every five years. After each vote, the results have to be counted. Here is how ballots are processed in Virtlandia.
There are voters, so ballots numbered from 1 to must be processed. Processing takes days. Each day, the election committee picks a natural number, then processes every ballot that has not been processed yet and whose number is divisible by the chosen number. On day , all ballots whose numbers are divisible by are processed. When the process ends, some ballots turned out not to be counted. Find how many ballots remain unprocessed.
Input
The first line contains two integers and (, ), the number of voters and the number of days for counting. The second line contains integers separated by spaces (), the numbers chosen by the election committee on each day.
Output
Print one integer, the answer to the problem: the number of ballots that remain unprocessed.