题目描述
Problem Background
After Chunhui went to study in the United States, Meiying often felt lonely. To alleviate her loneliness, she had special requirements for paints when painting.
Problem Description
Meiying has $n$ different types of paints, numbered from $1$ to $n$, and each type of paint can only be used once. When starting a painting, Meiying can choose any paint to use. Afterwards, Meiying will always choose a paint $i$ such that the greatest common divisor (gcd) of the numbers of the paints already used is maximized. Specifically:
Let the set of paint numbers already used be $A$. If there exists $i, j \notin A$ and $i, j \in [1, n]$ such that $gcd(A, i) > gcd(A, j)$, then paint $j$ cannot be chosen.
If there are multiple paints that meet the condition, Meiying can choose any one to use. Each time a paint is used, Meiying gains happiness equal to the gcd of the numbers of all paints currently used.
Now, Meiying wants to paint a picture using $m$ paints. What is the maximum total happiness she can obtain?
Input Format
A single line containing two positive integers $n$ and $m$, representing the number of paint types and the number of paints Meiying wants to use, respectively.
Output Format
A single positive integer representing the maximum happiness Meiying can obtain.
Sample Input and Output
Sample Input #1
7 4
Sample Output #1
11
Sample Input #2
15 3
Sample Output #2
25
Notes
$1 \le m \le n \le 10^7$
Sample Explanation
Sample 1: 6 3 5 2 is an optimal solution, with happiness values 6 3 1 1 respectively.
Sample 2: 15 10 5 is an optimal solution, with happiness values 15 5 5 respectively.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分