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

#GD0000149. Chọn tập tránh tổng mục tiêu (Anti-knapsack)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Chọn tập tránh tổng mục tiêu (Anti-knapsack)

Anti-knapsack

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given integers n,kn,k, choose as many distinct integers from 11 through nn as possible so that no subset of the chosen integers sums to kk. The empty subset has sum 00.

Print the largest possible number of chosen integers together with any set achieving that size.

Input

The input contains two integers n,kn,k.

Output

Print the maximum cardinality mm, then mm distinct integers in [1,n][1,n]. No subset of those integers may have sum kk.

Subtasks

  • Subtask 1 (20 points): 1≤k≤n≤201\le k\le n\le20.
  • Subtask 2 (30 points): 1≤k≤n≤1501\le k\le n\le150.
  • Subtask 3 (50 points): 1≤k≤n≤10001\le k\le n\le1000.

Examples

Input

5 3

Output

3
2 4 5

Explanation

For n=5,k=3n=5,k=3, the set {2,4,5}\{2,4,5\} has three elements. No subset sums to 33: 22 is too small by itself, and every other selected number exceeds 33. Adding 11 would create the forbidden sum 1+2=31+2=3.