Help me in solving SUMARRAY problem

My issue

With this code, I think the answer is matching with the condition in the statement. But while submitting it shows Wrong Answer.

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner (System.in);
		int t = sc.nextInt();
		while (t-->0)
		{
		    int n= sc.nextInt();
		    int s = sc.nextInt();
		//    int k = sc.nextInt();
	//	int k= sc.nextInt();
	if (s==1)
	System.out.println("-1");
	else
	{
		    int a[]= new int[n];
		    int sum=0;
		    int count=0;
		    for (int i=1; i<n; i++)
		    {a[i-1]= i;
		        sum+=i;
		        count++;
		    }
		   // if (s==1)
		  //  System.out.println("-1");
		    if((s-sum)%2==0)
		    {
		        a[count]= (s-sum);
		        for (int i=0; i<n; i++)
		        {System.out.print(a[i] + " ");}
		        System.out.println(" ");
		    }
		    else
		    System.out.println("-1");
		    
	}  
		}
	}
}

Problem Link: SUMARRAY Problem - CodeChef