Tianjin University Online Judge
Contests Virtual Contests Problems Submit Runs Status Rank List Forum

2790.   Fireworks Show
Time Limit: 1.0 Seconds   Memory Limit: 65536K
Total Runs: 1251   Accepted Runs: 451    Multiple test files



It's Independence Day, and Farmer John has taken the cows to the fireworks show. Bessie wonders how much of the show the cows will be able to see since they might not be able to stay for the entire display.

The show features C (1 ≤ C ≤ 100) fireworks cannons conveniently numbered 1..C. Cannon i shoots fireworks every Ti (1 ≤ Ti ≤ N) seconds (all times in this task are integer seconds). In a spectacular opening, all cannons first shoot at time 0. Fireworks are visible only during the second in which they are launched from the cannon. The cows will stay at the show from time 1 through time N (1 ≤ N ≤ 2,000,000).

Help Bessie figure out how many different times the cows will be able to see fireworks during the time period that they are at the show.

Input

* Line 1: Two space-separated integers: C and N.

* Lines 2..C + 1: Line i+1 contains the single integer Ti.

Output

* Line 1: A single integer that is the number of distinct seconds in the time interval from 1 through N that the cows will be able to see fireworks.

Sample Inpput

2 20
4
6

Sample Output

7

Input Details

The show features 2 cannons: one shooting fireworks every 4 seconds, the other shooting every 6 seconds. The cows will stay at the show from time 1 to time 20. Below is a chart showing the fireworks launches and the time the cows are present.
      CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
2                                   2                                   2 ...
1           1     2     1           1           1     2     1           1 ...
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ ...
0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ...

Output Details

There will be fireworks at times 4, 6, 8, 12, 16, 18, and 20, for a total of 7 distinct times. (Note that time 12, where both cannons shoot fireworks simultaneously, is only counted once.) See the graph above.


Source: USACO 2007 March Competition
Submit   List    Runs   Forum   Statistics

Tianjin University Online Judge v1.3.0
Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz