PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000059. Cắt phần giữa danh sách nguyên tố (Prime Cuts)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Cắt phần giữa danh sách nguyên tố (Prime Cuts)

Prime Cuts

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Build the ascending list containing 11 and every prime not greater than NN. Following the original statement’s convention, 11 is included in this list, even though 11 is not prime in modern mathematics. Let mm be the number of entries. If mm is even, select the central 2C2C consecutive entries; if mm is odd, select the central 2C−12C-1 entries. If this number exceeds mm, use the whole list. Print the selected entries in ascending order.

Input

One line contains integers NN and CC.

Output

Print a line formatted as N C: followed by the selected entries, each preceded by exactly one space. Print one additional blank line after the result.

Subtasks

  • Subtask 1 (20 points): 1≤N≤301\le N\le 30; 1≤C≤N1\le C\le N.
  • Subtask 2 (30 points): 1≤N≤2501\le N\le 250; 1≤C≤N1\le C\le N.
  • Subtask 3 (50 points): 1≤N≤10001\le N\le 1000; 1≤C≤N1\le C\le N.

Examples

Input

21 2

Output

21 2: 5 7 11

Explanation

The list through 2121 is 1,2,3,5,7,11,13,17,191,2,3,5,7,11,13,17,19, so m=9m=9. Since mm is odd and C=2C=2, take 2C−1=32C-1=3 central entries. Removing the first and last three gives 5,7,115,7,11. Print 21 2: 5 7 11, followed by a blank line.