Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/kombinatorika-bolinmaydiganlar

Divisible by none

Medium 1000 ms 128 MB 64%
Share

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}$?

Numbers from 1 to N; those divisible by the given numbers are crossed out, the rest are highlighted

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

Sign in to submit a solution

Signing up is free and takes a minute.