PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000230. Những vé số còn lại (The Lottery)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Những vé số còn lại (The Lottery)

Những vé số còn lại (The Lottery)

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

There are NN tickets numbered from 11 to NN. A ticket is removed if its number is divisible by at least one of the MM chosen positive integers. Count the tickets that are not removed. Chosen integers may repeat.

Input

  • First line: integers N,MN,M.
  • Second line: MM chosen positive integers.

Output

Print the number of tickets that remain.

Subtasks

  • Subtask 1 (20 points): 10≤N≤1000, 1≤M≤610\le N\le 1000,\ 1\le M\le 6.
  • Subtask 2 (30 points): 10≤N≤106, 1≤M≤1010\le N\le 10^6,\ 1\le M\le 10.
  • Subtask 3 (50 points): 10≤N<231, 1≤M≤1510\le N<2^{31},\ 1\le M\le 15.

Examples

Example 1

Input

10 2
2 3

Output

3

Explanation

The remaining ticket numbers are 1,5,71,5,7.

Example 2

Input

20 2
2 4

Output

10

Explanation

All numbers divisible by 44 are already divisible by 22, so exactly 10 tickets remain.