You are an ATF student visiting a tree with N levels. Each level of the tree has a…
- User
You are an ATF student visiting a tree with N levels. Each level of the tree has a unique treehouse. You are given n starting levels x1,x2,…,xn . If you start from level xi , you can only visit levels that are multiples of xi .
Determine the total number of distinct levels you can visit across all starting levels.
Input The first line contains two integers n and N (1≤n≤2×105,1≤N≤2×105) — the number of starting levels and the number of levels in the tree, respectively.
The second line contains n integers x1,x2,…,xn (1≤xi≤N) — the starting levels.
Output Output a single integer — the total number of distinct levels you can visit across all starting levels.
Examples Input 5 5 2 4 2 2 3 Output 3
- Assistant
To determine the total number of distinct levels you can visit across all starting levels, we need to consider all levels that are multiples of each given starting level ( x_i ) and ensure that we only count unique levels. Here is a detailed step-by-step approach to solve the problem:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.