~/algor $ cat problems/kombinatorika-bolinmaydiganlar
Divisible by none
Medium
1000 ms
128 MB
64%
A positive integer $N$ and $k$ positive integers $a_{1}, a_{2}, \dots, a_{k}$ are given. How many numbers from $1$ to $N$ are divisible by none of $a_{1}, a_{2}, \dots, a_{k}$?
Input
The first line contains two positive integers: $N$ and $k$. The second line contains $k$ space-separated positive integers $a_{i}$.
Output
One integer — the number of numbers divisible by none of them.
Note
$1 \le N \le 10^{18}$
$1 \le k \le 10$
$2 \le a_{i} \le 10^{9}$
Examples
Input #1
20 2 2 3
Output #1
7
Input #2
10 3 2 4 8
Output #2
5