Under construction

Still being built. Things may change

Firework Show

Interview

Time limit2sMemory limit128 MB

Summary
Given N firework periods and an end time C, count how many distinct seconds from 1 to C have at least one firework fired by any student.
Level

Easy3 of 10

Topics
Array, Math, Simulation
Solved
No attempts yet

Problem

Students bought discounted fireworks after New Year's Day and are setting them off.

During the firework show, N students set off fireworks. Each student uses a fixed period; periods may be the same or different. We observe time in whole seconds, and fireworks also go off at whole seconds.

Determine how many distinct seconds show at least one firework in the sky before the show ends.

Input

The first line contains the number of students N (1 ≤ N ≤ 100) and the ending time C (1 ≤ C ≤ 2,000,000). Each of the next N lines contains one student's firework period. Each period is a natural number between 1 and C, inclusive.

Output

Print the number of distinct seconds between second 1 and second C, inclusive, when at least one firework is visible in the sky.

Hint

                                    2                        
            1     2     1           1           1     2     1
0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
            1     2     3           4           5     6     7

In the diagram above, fireworks go off at seconds 4, 6, 8, 12, 16, 18, and 20, where the numbers 1 and 2 are written. At second 12, two fireworks go off at the same time, but that second is counted only once.

Examples1

  1. Example 1

    Input
    2 20
    4
    6
    
    Expected output
    7