Codeforces Round 166 (Div. 2)
E
Three Horses
Codeforces
2200
原题
← D→
翻译中…

There are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must contain two integers, the first one on top, the second one in the bottom of the card. Let's denote a card with $*a*$ on the top and $*b*$ in the bottom as $(*a*, *b*)$.

翻译中…

Each of the three horses can paint the special cards. If you show an $(*a*, *b*)$ card to the gray horse, then the horse can paint a new $(*a* + 1, *b* + 1)$ card. If you show an $(*a*, *b*)$ card, such that $*a*$ and $*b*$ are even integers, to the white horse, then the horse can paint a new image card. If you show two cards $(*a*, *b*)$ and $(*b*, *c*)$ to the gray-and-white horse, then he can paint a new $(*a*, *c*)$ card.

翻译中…

Polycarpus really wants to get $*n*$ special cards $(1, *a*_{1})$, $(1, *a*_{2})$, $...$, $(1, *a*_{*n*})$. For that he is going to the horse land. He can take exactly one $(*x*, *y*)$ card to the horse land, such that $1 ≤ *x* < *y* ≤ *m*$. How many ways are there to choose the card so that he can perform some actions in the horse land and get the required cards?

翻译中…

Polycarpus can get cards from the horses only as a result of the actions that are described above. Polycarpus is allowed to get additional cards besides the cards that he requires.

翻译中…

Input

翻译中…

The first line contains two integers $*n*, *m*$ $(1 ≤ *n* ≤ 10^{5}, 2 ≤ *m* ≤ 10^{9})$. The second line contains the sequence of integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ $(2 ≤ *a*_{*i*} ≤ 10^{9})$. Note, that the numbers in the sequence can coincide.

翻译中…

The numbers in the lines are separated by single spaces.

翻译中…

Output

翻译中…

Print a single integer — the answer to the problem.

翻译中…

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.

翻译中…

样例

Input #1
1 6
2
Output #1
11
InputCopy OutputCopy
Input #2
1 6
7
Output #2
14
InputCopy OutputCopy
Input #3
2 10
13 7
Output #3
36
InputCopy OutputCopy
题目信息
题号
271E
时间限制
2 s
内存限制
256 MB
标签
构造
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。