Subarray Sum

All submissions for this problem are available.
SubarraySet of an array is defined as the set of sum of each subarray of the array. More formally for array A, SubarraySet of A consists of A_{i} + A_{i+1} .. A_{j} for 1 ≤ i ≤ j ≤ N .For example, SubarraySet of array [1,2,5] is the set {1,2,3,5,7,8}.
A is an array of positive integers having N elements. The elements of the array are not known. However, it is known that the sum of all elements of A is S.
Find the numbers which always occur in the SubarraySet of A for any array satisfying the above constraints.
Input
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains two integers N and S, denoting the size of array and sum of elements of the array respectively.
Output
In the first line print the number of numbers which always occur in the SubarraySet of A.
In the next line print the numbers in increasing order.
Constraints
Example
Input: 2 3 5 5 6
Output: 3 1 3 5 6 1 2 3 4 5 6
Explanation
Example case 1.Possible arrays are [1,1,3], [1,3,1], [3,1,1] ,[1,2,2] ,[2,1,2] ,[2,2,1]. In each of these there exists subarrays which have sum 1,3 and 5.
Author:  skullcrackers 
Editorial  http://discuss.codechef.com/problems/SSUM 
Tags  ipc151a, maths, pigeonhole, skullcrackers 
Date Added:  8102015 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 