N, S = gets.split.map(&:to_i) ans = [*1..N] sum = N * (N + 1) / 2 while sum > S v = ans.pop sum -= v end if sum < S sum += ans.last + 1 ans.push(ans.last + 1) diff = sum - S ans.delete_if { |a| a == diff } end puts ans.size puts ans.join(' ')