1813.Maximal GCD

Time Limit: 1s Memory Limit: 256MB

You are given positive integer number n. You should create such strictly increasing sequence of k positive numbers a1,a2,...,ak, that their sum is equal to n and greatest common divisor is maximal.

Greatest common divisor of sequence is maximum of such numbers that every element of sequence is divisible by them.

If there is no possible sequence then output -1.

Input Format(From the terminal/stdin)

The first line consists of two numbers n and k (1 \le n,k \le 1010).

Output Format(To the terminal/stdout)

If the answer exists then output k numbers - resulting sequence. Otherwise output -1. If there are multiple answers, print any of them.

Sample Input 1

Copy
6 3
 · \n

Sample Output 1

Copy
1 2 3
 · · \n

Sample Input 2

Copy
8 2
 · \n

Sample Output 2

Copy
2 6
 · \n

Sample Input 3

Copy
5 3
 · \n

Sample Output 3

Copy
-1
  \n

Submit

请先 登录

© 2025 FAQs