## https://yukicoder.me/problems/no/2028 def main(): N, S = map(int, input().split()) total = (N * (N + 1)) // 2 a_set = {i + 1 for i in range(N)} for n in reversed(range(1, N + 1)): d = total - S if d == 0: break elif d <= n: total -= d a_set.remove(d) else: total -= n a_set.remove(n) a_list = list(a_set) a_list.sort() print(len(a_list)) print(" ".join(map(str, a_list))) if __name__ == "__main__": main()