Under construction

Still being built. Things may change

Multiples of Primes

Interview

Time limit0.25sMemory limit512 MB

Summary
Given up to 10 distinct primes and a limit M up to 1e12, count the natural numbers at most M divisible by at least one listed prime.
Level

Medium7 of 10

Topics
Combinatorics, Math, Number theory, Bit manipulation
Solved
No attempts yet

Problem

You are given NN primes and a natural number MM. Among the natural numbers not exceeding MM, count how many are divisible by at least one of the NN primes.

Input

The first line contains NN (1≤N≤101 \le N \le 10) and MM (1≤M≤10121 \le M \le 10^{12}). The second line contains NN primes. Each given prime is at most 100100, and no prime appears more than once.

Output

Print the number of natural numbers not exceeding MM that are divisible by at least one of the NN primes.

Examples5

  1. Example 1

    Input
    1 100
    3
    
    Expected output
    33
    
  2. Example 2

    Input
    2 100
    2 3
    
    Expected output
    67
    
  3. Example 3

    Input
    3 100
    2 3 5
    
    Expected output
    74
    
  4. Example 4

    Input
    4 100
    2 3 5 7
    
    Expected output
    78
    
  5. Example 5

    Input
    5 100
    11 13 17 19 23
    
    Expected output
    30