#Lutece1420. 条头日今の面试(二)

条头日今の面试(二)

Migrated from Lutece 1420 条头日今の面试(二)

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

省府弟子乐天潭在条头日今的笔试中遇到了四道题,其中第二题是:

已知 n 和 t,构造一棵 n 个结点的树,使得边权和最大。

结点的编号为 1 到 n ,对于边权 w(u,v) = GCD(u,v) &t。

乐天潭很强势,一眼就知道了解法,但计算量实在过大,没办法只好偷偷掏出手机请你帮他写一个程序算出答案。

Input

第一行,两个整数 n (1 <= n <= 1000000),t (1 <= t <= 10^9+7)。

Output

输出一行,一个整数,表示答案。

Samples

3 3
2

Resources

2016 UESTC Training for Graph Theory