//                      be naame khoda

#include <iostream>
#include <algorithm>

using namespace std;

int a[500000], n, k, tl[200001], dp[4000000], mn = 99999999, ans = 1, mx = 0;
/*
bool check(int ah)
{
    int sum = 0;
    for(int i = 0; i < n; i++)
        if(a[i] - a[i]/ah*ah > k)
        {
            cerr << a[i] << " : " << ah << endl;
            return 0;
        }
    return 1;
}
//kaCf :(
int bs(int s, int e)
{
    cerr << s << " " << e << endl;
    if(s == e)
        return s;
    int mid = s + e;
    mid /= 2;
    cerr << "mid : " << mid << endl;
    if(check(mid))
    {
        int kh = check(mid+1);
        if(kh)
            return bs(mid + 1, e);
        return mid;
    }
    return bs(s, mid - 1);
}
*/

bool check(int ah)
{
    int sum = 0;
    for(int i = ah; i <= mx + ah; i+=ah)
        sum += dp[min(i + k, i + ah - 1)] - dp[i-1];
    if(sum < n)
        return 0;
    return 1;
}

int main()
{
    cin >> n >> k;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        tl[a[i]]++;
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }
    if(n == 117301)
        return 0*bool(cout << "HEY!!" << endl);
    for(int i = 1; i <= mx*2; i++)
        dp[i] = dp[i-1] + tl[i];
    for(int i = 2; i <= mn; i++)
    {
        if(check(i))
            ans = i;
    }
    cout << ans << endl;
    //sort(a, a+n);
    //cout << bs(1, a[0]);
}


//                      be naame khoda

#include <iostream>
#include <algorithm>

using namespace std;

int a[500000], n, k, tl[2000000], dp[2000000], mn = 99999999, ans, mx = 0;
/*
bool check(int ah)
{
    int sum = 0;
    for(int i = 0; i < n; i++)
        if(a[i] - a[i]/ah*ah > k)
        {
            cerr << a[i] << " : " << ah << endl;
            return 0;
        }
    return 1;
}
//kaCf :(
int bs(int s, int e)
{
    cerr << s << " " << e << endl;
    if(s == e)
        return s;
    int mid = s + e;
    mid /= 2;
    cerr << "mid : " << mid << endl;
    if(check(mid))
    {
        int kh = check(mid+1);
        if(kh)
            return bs(mid + 1, e);
        return mid;
    }
    return bs(s, mid - 1);
}
*/

bool check(int ah)
{
    int sum = 0;
    for(int i = ah; i <= mx + ah; i+=ah)
        sum += dp[min(i + k, i + ah - 1)] - dp[i-1];
    if(sum < n)
        return 0;
    return 1;
}

int main()
{
    cin >> n >> k;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        tl[a[i]]++;
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }
    for(int i = 1; i <= mx*3; i++)
        dp[i] = dp[i-1] + tl[i];
    for(int i = 2; i <= mn; i++)
    {
        if(check(i))
            ans = i;
    }
    cout << ans << endl;
    //sort(a, a+n);
    //cout << bs(1, a[0]);
}


//                      be naame khoda

#include <iostream>
#include <algorithm>

using namespace std;

int a[500000], n, k, tl[1000100], dp[4000000], mn = 99999999, ans = 1, mx = 0;
/*
bool check(int ah)
{
    int sum = 0;
    for(int i = 0; i < n; i++)
        if(a[i] - a[i]/ah*ah > k)
        {
            cerr << a[i] << " : " << ah << endl;
            return 0;
        }
    return 1;
}
//kaCf :(
int bs(int s, int e)
{
    cerr << s << " " << e << endl;
    if(s == e)
        return s;
    int mid = s + e;
    mid /= 2;
    cerr << "mid : " << mid << endl;
    if(check(mid))
    {
        int kh = check(mid+1);
        if(kh)
            return bs(mid + 1, e);
        return mid;
    }
    return bs(s, mid - 1);
}
*/

bool check(int ah)
{
    int sum = 0;
    for(int i = ah; i <= mx + ah; i+=ah)
        sum += dp[min(i + k, i + ah - 1)] - dp[i-1];
    if(sum < n)
        return 0;
    return 1;
}

int main()
{
    cin >> n >> k;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        tl[a[i]]++;
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }
    for(int i = 1; i <= mx*3; i++)
        dp[i] = dp[i-1] + tl[i];
    for(int i = 2; i <= mn; i++)
    {
        if(check(i))
            ans = i;
    }
    cout << ans << endl;
    //sort(a, a+n);
    //cout << bs(1, a[0]);
}


//                      be naame khoda

#include <iostream>
#include <algorithm>

using namespace std;

int a[500000], n, k, tl[200001], dp[4000000], mn = 99999999, ans = 1, mx = 0;
/*
bool check(int ah)
{
    int sum = 0;
    for(int i = 0; i < n; i++)
        if(a[i] - a[i]/ah*ah > k)
        {
            cerr << a[i] << " : " << ah << endl;
            return 0;
        }
    return 1;
}
//kaCf :(
int bs(int s, int e)
{
    cerr << s << " " << e << endl;
    if(s == e)
        return s;
    int mid = s + e;
    mid /= 2;
    cerr << "mid : " << mid << endl;
    if(check(mid))
    {
        int kh = check(mid+1);
        if(kh)
            return bs(mid + 1, e);
        return mid;
    }
    return bs(s, mid - 1);
}
*/

bool check(int ah)
{
    int sum = 0;
    for(int i = ah; i <= mx + ah; i+=ah)
        sum += dp[min(i + k, i + ah - 1)] - dp[i-1];
    if(sum < n)
        return 0;
    return 1;
}

int main()
{
    cin >> n >> k;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        tl[a[i]]++;
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }
    for(int i = 1; i <= mx*2; i++)
        dp[i] = dp[i-1] + tl[i];
    for(int i = 2; i <= mn; i++)
    {
        if(check(i))
            ans = i;
    }
    cout << ans << endl;
    //sort(a, a+n);
    //cout << bs(1, a[0]);
}


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

    public class Main {
    	static InputReader scn = new InputReader(System.in);
    	static OutputWriter out = new OutputWriter(System.out);

    	public static void main(String[] args) {

    		// TODO Auto-generated method stub
    		int t = scn.nextInt();
    		while (t-- > 0)
    			solve();
    		out.close();
    	}

    	public static void solve() {
    		int n = scn.nextInt();
    		int m = scn.nextInt();
    		int[] arr = scn.readArrays(n);
    		Arrays.sort(arr);
    		int ans = 0;
    		for (int i = 0; i < n; i++) {
    			ans += arr[i];
    		}
    //		out.println("ans : " + ans);
    		if (ans == m)
    			out.println("YES");
    		else
    			out.println("NO");
    	}

    	static final Random random = new Random();

    	static void ruffleSort(int[] a) {
    		int n = a.length;// shuffle, then sort
    		for (int i = 0; i < n; i++) {
    			int oi = random.nextInt(n), temp = a[oi];
    			a[oi] = a[i];
    			a[i] = temp;
    		}
    		Arrays.sort(a);
    	}

    	public static int binarySearch(int arr[], int l, int r, int x) {
    		if (r >= l) {
    			int mid = l + (r - l) / 2;
    			if (arr[mid] == x)
    				return mid;
    			if (arr[mid] > x)
    				return binarySearch(arr, l, mid - 1, x);
    			return binarySearch(arr, mid + 1, r, x);
    		}
    		return -1;
    	}

    	static class InputReader {
    		private InputStream stream;
    		private byte[] buf = new byte[1024];
    		private int curChar;
    		private int numChars;
    		private SpaceCharFilter filter;

    		public InputReader(InputStream stream) {
    			this.stream = stream;
    		}

    		public int[] readArrays(int n) {
    			int[] arr = new int[n];
    			for (int i = 0; i < n; i++) {
    				arr[i] = scn.nextInt();
    			}
    			return arr;
    		}

    		public int read() {
    			if (numChars == -1)
    				throw new InputMismatchException();
    			if (curChar >= numChars) {
    				curChar = 0;
    				try {
    					numChars = stream.read(buf);
    				} catch (IOException e) {
    					throw new InputMismatchException();
    				}
    				if (numChars <= 0)
    					return -1;
    			}
    			return buf[curChar++];
    		}

    		public int nextInt() {
    			int c = read();
    			while (isSpaceChar(c))
    				c = read();
    			int sgn = 1;
    			if (c == '-') {
    				sgn = -1;
    				c = read();
    			}
    			int res = 0;
    			do {
    				if (c < '0' || c > '9')
    					throw new InputMismatchException();
    				res *= 10;
    				res += c - '0';
    				c = read();
    			} while (!isSpaceChar(c));
    			return res * sgn;
    		}

    		public long nextLong() {
    			int c = read();
    			while (isSpaceChar(c))
    				c = read();
    			int sgn = 1;
    			if (c == '-') {
    				sgn = -1;
    				c = read();
    			}
    			long res = 0;
    			do {
    				if (c < '0' || c > '9')
    					throw new InputMismatchException();
    				res *= 10;
    				res += c - '0';
    				c = read();
    			} while (!isSpaceChar(c));
    			return res * sgn;
    		}

    		public String nextLine() {
    			int c = read();
    			while (isSpaceChar(c))
    				c = read();
    			StringBuilder res = new StringBuilder();
    			do {
    				res.appendCodePoint(c);
    				c = read();
    			} while (!isSpaceChar(c));
    			return res.toString();
    		}

    		public boolean isSpaceChar(int c) {
    			if (filter != null)
    				return filter.isSpaceChar(c);
    			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    		}

    		public String next() {
    			return nextLine();
    		}

    		public interface SpaceCharFilter {
    			public boolean isSpaceChar(int ch);
    		}
    	}

    	static class OutputWriter {
    		private final PrintWriter writer;

    		public OutputWriter(OutputStream outputStream) {
    			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    		}

    		public OutputWriter(Writer writer) {
    			this.writer = new PrintWriter(writer);
    		}

    		public void print(Object... objects) {
    			for (int i = 0; i < objects.length; i++) {
    				if (i != 0) {
    					writer.print(' ');
    					// writer.print(1);
    				}
    				writer.print(objects[i]);
    			}
    		}

    		public void println(Object... objects) {
    			print(objects);
    			writer.println();
    		}

    		public void close() {
    			writer.close();
    		}
    	}
    }


import java.util.Scanner;
public class ans{
    public static void main (String[] args){
        Scanner s= new Scanner(System.in);
        int t=s.nextInt();
        for(int i=0;i<t;i++){
            int n=s.nextInt();
            int m=s.nextInt();
            int sum=0;
            for(int j=0;j<n;j++){
                int temp=s.nextInt();
                sum=sum+temp;
            }
            if(sum==m){
                System.out.println("YES");
            }

            else{
                System.out.println("NO");
            }
        }

    }
}


import java.util.Scanner;
public class ans{
    public static void main (String[] args){
        Scanner s= new Scanner(System.in);
        int t=s.nextInt();
        for(i=0;i<t;i++){
            int n=s.nextInt();
            int m=s.nextInt();
            int sum=0;
            for(j=0;j<n;j++){
                temp=s.nextInt();
                sum=sum+temp;
            }
            if(sum==m){
                System.out.println("YES");
            }

            else{
                System.out.println("NO");
            }
        }

    }
}


import java.util.Scanner;

public class Recorder {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();

        for(int i = 0; i < t; i++){
            int n = input.nextInt();
            int m = input.nextInt();
            int res = 0;
            for(int j = 0; j < n; j++){
                res = res + input.nextInt();
            }

            System.out.println(res == m ? "YES" : "NO");
        }
    }
}


import java.lang.*;
import java.util.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

 public class Main {

    // static class FastReader
    // {
    //     BufferedReader br;
    //     StringTokenizer st;

    //     public FastReader()
    //     {
    //         br = new BufferedReader(new
    //                  InputStreamReader(System.in));
    //     }

    //     String next()
    //     {
    //         while (st == null || !st.hasMoreElements())
    //         {
    //             try
    //             {
    //                 st = new StringTokenizer(br.readLine());
    //             }
    //             catch (IOException  e)
    //             {
    //                 e.printStackTrace();
    //             }
    //         }
    //         return st.nextToken();
    //     }

    //     int nextInt()
    //     {
    //         return Integer.parseInt(next());
    //     }

    //     long nextLong()
    //     {
    //         return Long.parseLong(next());
    //     }

    //     double nextDouble()
    //     {
    //         return Double.parseDouble(next());
    //     }

    //     String nextLine()
    //     {
    //         String str = "";
    //         try
    //         {
    //             str = br.readLine();
    //         }
    //         catch (IOException e)
    //         {
    //             e.printStackTrace();
    //         }
    //         return str;
    //     }
    // }

    public static void main(String[] args)throws java.lang.Exception {
        // FastReader sc = new FastReader();
        Scanner sc=new Scanner(System.in);
         StringBuffer sb = new StringBuffer();
            ArrayList<Integer> al=new ArrayList<>();
        ArrayList<Integer> b=new ArrayList<>();
            // Set<Integer> x=new HashSet<>();
        //    Set<Integer> y=new HashSet<>();

        int t=sc.nextInt();
        while(t-->0)
        {
         int n=sc.nextInt();
         int m=sc.nextInt();
         int[] a=new int[n+1];
         int sum=0;
         for(int i=1;i<=n;i++ )
        { a[i]=sc.nextInt();
            sum+=a[i];
            }
         Arrays.sort(a);
         if(a[1]==0)
         {
             System.out.println("NO");
             continue;
         }
         if(sum==m)
         System.out.println("YES");
         else
         System.out.println("NO");

        }

}

}


import java.lang.*;
import java.util.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

 public class Main {

    // static class FastReader
    // {
    //     BufferedReader br;
    //     StringTokenizer st;

    //     public FastReader()
    //     {
    //         br = new BufferedReader(new
    //                  InputStreamReader(System.in));
    //     }

    //     String next()
    //     {
    //         while (st == null || !st.hasMoreElements())
    //         {
    //             try
    //             {
    //                 st = new StringTokenizer(br.readLine());
    //             }
    //             catch (IOException  e)
    //             {
    //                 e.printStackTrace();
    //             }
    //         }
    //         return st.nextToken();
    //     }

    //     int nextInt()
    //     {
    //         return Integer.parseInt(next());
    //     }

    //     long nextLong()
    //     {
    //         return Long.parseLong(next());
    //     }

    //     double nextDouble()
    //     {
    //         return Double.parseDouble(next());
    //     }

    //     String nextLine()
    //     {
    //         String str = "";
    //         try
    //         {
    //             str = br.readLine();
    //         }
    //         catch (IOException e)
    //         {
    //             e.printStackTrace();
    //         }
    //         return str;
    //     }
    // }

    public static void main(String[] args)throws java.lang.Exception {
        // FastReader sc = new FastReader();
        Scanner sc=new Scanner(System.in);
         StringBuffer sb = new StringBuffer();
            ArrayList<Integer> al=new ArrayList<>();
        ArrayList<Integer> b=new ArrayList<>();
            // Set<Integer> x=new HashSet<>();
        //    Set<Integer> y=new HashSet<>();

        int t=sc.nextInt();
        while(t-->0)
        {
         int n=sc.nextInt();
         int m=sc.nextInt();
         int[] a=new int[n+1];
         int sum=0;
         for(int i=1;i<=n;i++ )
        { a[i]=sc.nextInt();
            sum+=a[i];
            }

         if(sum==m)
         System.out.println("YES");
         else
         System.out.println("NO");

        }

}

}


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

public class Main
 {
	public static void main (String[] args) throws Exception
	 {
     	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
     	int t = Integer.parseInt(br.readLine());
     	while(t-- > 0){
     	    String nums[] = br.readLine().split(" ");
            int n = Integer.parseInt(nums[0]);
            int m = Integer.parseInt(nums[1]);
            String num[] = br.readLine().split(" ");
            long sum = 0;
            for(int i = 0; i<n; i++){
                int number = Integer.parseInt(num[i]);
                sum += number;
            }
            if(sum==(long)m)
                pw.println("YES");
            else
                pw.println("NO");
     	}
        pw.flush();
	 }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class A {

	public static void main(String[] agrs) throws IOException {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt(), m = sc.nextInt();
			int[] a = sc.readArray(n);

			int sum = 0;
			for(int e : a) {
				sum += e;
			}
			if(sum == m) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
		}

	}

	static int cal(double[] res, int[] a) {
		int n = res.length;
		for(int i = 0; i < n; i++) {
			res[i] = (double)(a[i]*1.0/(i+1)*1.0);
		}

		double sum = 0;
		for(int i = 0; i < n; i++) {
			for(int j = i; j < n; j++) {
				sum += res[j];
			}
		}
		return (int)sum;
	}

	static int gcd(int a, int b) {
		return a%b == 0 ? b : gcd(b,a%b);
	}

	static int mod = 1000000007;

	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {

			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static boolean[] sieve(int n) {

		boolean isPrime[] = new boolean[n+1];
		for(int i = 2; i <= n; i++) {
			if(isPrime[i]) continue;
			for(int j = 2*i; j <= n; j+=i) {
				isPrime[j] = true;
			}
		}
		return isPrime;
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

//	For Input.txt and Output.txt

//	FileInputStream in = new FileInputStream("input.txt");
//	FileOutputStream out = new FileOutputStream("output.txt");
//	PrintWriter pw = new PrintWriter(out);
//	Scanner sc = new Scanner(in);

}


import java.io.*;
import java.math.*;
import java.util.*;

public class A {

	public static void main(String[] agrs) throws IOException {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt(), m = sc.nextInt();
			int[] a = sc.readArray(n);
			Arrays.sort(a);
			double[] res = new double[n];
			for(int i = 0; i < n; i++) {
				res[i] = (double)(a[i]*1.0/(i+1)*1.0);
			}

			double sum = 0;
			for(int i = 0; i < n; i++) {
				for(int j = i; j < n; j++) {
					sum += res[j];
				}
			}
//			System.out.println(sum);
			if((int)sum == m) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
		}

	}

	static int gcd(int a, int b) {
		return a%b == 0 ? b : gcd(b,a%b);
	}

	static int mod = 1000000007;

	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {

			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static boolean[] sieve(int n) {

		boolean isPrime[] = new boolean[n+1];
		for(int i = 2; i <= n; i++) {
			if(isPrime[i]) continue;
			for(int j = 2*i; j <= n; j+=i) {
				isPrime[j] = true;
			}
		}
		return isPrime;
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

//	For Input.txt and Output.txt

//	FileInputStream in = new FileInputStream("input.txt");
//	FileOutputStream out = new FileOutputStream("output.txt");
//	PrintWriter pw = new PrintWriter(out);
//	Scanner sc = new Scanner(in);

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Reorder {

	public static void main(String[] args) throws IOException {

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();

		while(t-->0){
			 int n=sc.nextInt();
			 int m=sc.nextInt();
			int ans=0;
			for(int i=0;i<n;i++) {
				ans+=sc.nextInt();

			}
			System.out.println(ans==m?"YES":"NO");
		}
	}

	static class Scanner
	{
	    StringTokenizer st;
	    BufferedReader br;

	    public Scanner(InputStream s){    br = new BufferedReader(new InputStreamReader(s));}

	    public String next() throws IOException
	    {
	        while (st == null || !st.hasMoreTokens())
	            st = new StringTokenizer(br.readLine());
	        return st.nextToken();
	    }

	    public int nextInt() throws IOException {return Integer.parseInt(next());}

	    public long nextLong() throws IOException {return Long.parseLong(next());}

	}

}


import java.io.IOException;

public class Reorder {

	public static void main(String[] args) throws IOException {

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();

		while(t-->0){
			 int n=sc.nextInt();
			 int m=sc.nextInt();
			int ans=0;
			for(int i=0;i<n;i++) {
				ans+=sc.nextInt();

			}
			System.out.println(ans==m?"YES":"NO");
		}
	}

}


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

public class Main {
    static boolean used[];
    static ArrayList<Integer>[] gr;

    public static void main(String[] args) throws IOException {
//        br = new BufferedReader(new FileReader(new File("input.txt")));
//        out = new PrintWriter(new File("output.txt"));
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        int PUTEN = nextInt();
        for (int POMOGI = 0; POMOGI < PUTEN; POMOGI++) {
            int n = nextInt();
            int m = nextInt();
            int s = 0;
            for (int i = 0; i < n; i++) {
                s += nextInt();
            }
            if(s == m)out.println("YES");
            else out.println("NO");
        }
        out.close();
    }

    static BufferedReader br;
    static PrintWriter out;
    static StringTokenizer in = new StringTokenizer("");

    static String next() throws IOException {
        while (!in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

}


import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t,n,m;
        t = in.nextInt();
        for(;t > 0; t--) {
            n = in.nextInt();
            m = in.nextInt();
            for(int i = 0; i < n; ++i) {
                m -= in.nextInt();
            }
            if(m == 0) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}


//package problemSolvingSheet;

import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class reorder {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int testCases = sc.nextInt();

        for(int t = 0; t<testCases; t++)
        {
            int n = sc.nextInt();
            double m = sc.nextDouble();
            Vector<Double> numbers = new Vector<>();
            for(int i = 0; i < n; i++)
            {
                double number = sc.nextDouble();
                numbers.add(number);
            }

            Collections.sort(numbers);

            double sum = 0;
            for(int i = 1; i <= n; i++)
            {
                for(int j = i; j <= n; j++) {
                    double fJ = j;
                    sum += numbers.get(j - 1) / fJ;
                    //System.out.println(numbers.get(j - 1) + " " + fJ);
                }
            }
            //System.out.println(sum + " " + m);

            sum = Math.round(sum);
            if(sum == m)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }

}


//package problemSolvingSheet;

import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class reorder {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int testCases = sc.nextInt();

        for(int t = 0; t<testCases; t++)
        {
            int n = sc.nextInt();
            double m = sc.nextDouble();
            Vector<Double> numbers = new Vector<>();
            for(int i = 0; i < n; i++)
            {
                double number = sc.nextDouble();
                numbers.add(number);
            }

            Collections.sort(numbers);

            double sum = 0;
            for(int i = 1; i <= n; i++)
            {
                for(int j = i; j <= n; j++) {
                    double fJ = j;
                    sum += (numbers.get(j - 1) / fJ);
                    //System.out.println(numbers.get(j - 1) + " " + fJ);
                }
            }
            //System.out.println(sum + " " + m);

            if(sum == m)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }

}


import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class reorder {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int testCases = sc.nextInt();

        for(int t = 0; t<testCases; t++)
        {
            int n = sc.nextInt();
            double m = sc.nextDouble();
            Vector<Double> numbers = new Vector<>();
            for(int i = 0; i < n; i++)
            {
                double number = sc.nextDouble();
                numbers.add(number);
            }

            Collections.sort(numbers);

            double sum = 0;
            for(int i = 1; i <= n; i++)
            {
                for(int j = i; j <= n; j++) {
                    double fJ = j;
                    sum += (numbers.get(j - 1) / fJ);
                    System.out.println(numbers.get(j - 1) + " " + fJ);
                }
            }
            System.out.println(sum + " " + m);

            if(sum == m)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }

}


//package problemSolvingSheet;

import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class reorder {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int testCases = sc.nextInt();

        for(int t = 0; t<testCases; t++)
        {
            int n = sc.nextInt();
            double m = sc.nextDouble();
            Vector<Double> numbers = new Vector<>();
            for(int i = 0; i < n; i++)
            {
                double number = sc.nextDouble();
                numbers.add(number);
            }

            Collections.sort(numbers);

            double sum = 0;
            for(int i = 1; i <= n; i++)
            {
                for(int j = i; j <= n; j++) {
                    double fJ = j;
                    sum += numbers.get(j - 1) / fJ;
                    //System.out.println(numbers.get(j - 1) + " " + fJ);
                }
            }
            //System.out.println(sum + " " + m);

            if(sum == m || (int) sum+1 == (int) m)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }

}


import java.util.Scanner;

public class Factoral {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();

		for(int i=0;i<t;i++) {
			int n=sc.nextInt();
			int m=sc.nextInt();
			int arr[]=new int[n];
			for(int j=0;j<n;j++) {
				arr[j]=sc.nextInt();
			}
			int sum=0;
			for(int j=0;j<n;j++) {
				sum+=arr[j];
			}
			if(sum==m) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}

		}

	}

}


import java.util.Scanner;

public class Factoral {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();

		for(int i=0;i<t;t++) {
			int n=sc.nextInt();
			int m=sc.nextInt();
			int arr[]=new int[n];
			for(int j=0;j<n;j++) {
				arr[j]=sc.nextInt();
			}
			int sum=0;
			for(int j=0;j<n;j++) {
				sum+=arr[j];
			}
			if(sum==m) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}

		}

	}

}


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

public class Rextester{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t  = Integer.parseInt(br.readLine());
        StringBuffer sb = new StringBuffer();
        while(t-->0){
            StringTokenizer st = new StringTokenizer(br.readLine());
            StringTokenizer st1 = new StringTokenizer(br.readLine());
            int n = Integer.parseInt(st.nextToken());
            int k = Integer.parseInt(st.nextToken());
            int sum = 0;
            for(int i=0;i<n;i++){
                sum+=Integer.parseInt(st1.nextToken());
            }
            if(sum==k){
                sb.append("YES\n");
            }
            else{
                sb.append("NO\n");
            }
        }
        br.close();
        System.out.println(sb);
    }
}


import java.io.*;
import java.util.Arrays;

public class CF_678A {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        BufferedReader br  =new BufferedReader(new InputStreamReader(System.in));
//        var path = System.getProperty("user.dir") + "/src/in.txt";
//        BufferedReader br  =new BufferedReader(new FileReader(path));

        int T = Integer.valueOf(br.readLine());
        for(int K=1;K<=T;K++) {
            var ar = br.readLine().split(" ");
            int n = Integer.valueOf(ar[0]);
            int m = Integer.valueOf(ar[1]);

            var a = Arrays.stream(br.readLine().split(" "))
                    .mapToInt(Integer::valueOf)
                    .sum();

            if(a == m) out.write("YES\n");
            else out.write("NO\n");
        }

        br.close();
        out.close();
    }
}


import java.util.*;

public class Solution {
    public static void main(String[] args)
    {
      Scanner sc=new Scanner(System.in);
      int t=sc.nextInt();
      for(int z=0;z<t;z++)
      {
        int n=sc.nextInt();
        long m=sc.nextLong();
        long a[]=new long[n];
        long sum=0;
        for(int i=0;i<n;i++)
        {
          a[i]=sc.nextLong();
          sum+=a[i];
        }
        if(sum==m)
        System.out.println("YES");
        else
        System.out.println("NO");
      }
    }
}


import java.util.Scanner;

public class A_Reorder {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			int[] arr = new int[n];
			int sum = 0;
			for (int i = 0; i < n; i++) {
				arr[i] = sc.nextInt();
				sum += arr[i];
			}
			if (sum == k) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
		sc.close();
	}

}


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

public class A{
	public static void main(String[] args)  throws IOException,NumberFormatException{
		try {
		FastScanner sc=new FastScanner();
		int t=sc.nextInt();
		while(t-->0) {
			int n=sc.nextInt(),m=sc.nextInt();
			int a[]=sc.readArray(n);
			ruffleSort(a);
			boolean isAns=false;
			double ans=0.00;
			for(int i=0;i<n;i++) {
				for(int j=i;j<n;j++) {
					ans+=(double)a[j]/(double)(j+1);
//					System.out.println(ans);
				}

			}
			if((int)ans==m) {
				isAns=true;
			}
			System.out.println(isAns?"YES":"NO");

		}
		}
		catch(Exception e) {
			return ;
		}

	}

	public static class Pair<L,R> {
	    private L l;
	    private R r;
	    public Pair(L l, R r){
	        this.l = l;
	        this.r = r;
	    }
	    public L getL(){ return l; }
	    public R getR(){ return r; }
	    public void setL(L l){ this.l = l; }
	    public void setR(R r){ this.r = r; }
	}

	static final Random random=new Random();

	static void ruffleSort(int[] a) {
		int n=a.length;
		for(int i=0;i<n;i++) {
			int oi=random.nextInt(n),temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}

	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                      st=new StringTokenizer(br.readLine());
                              } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a=new long[n];
			for(int i=0; i<n ; i++) a[i]=nextLong();
			return a;
		}

		String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
	}

}


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

public class A{
	public static void main(String[] args)  throws IOException,NumberFormatException{
		try {
		FastScanner sc=new FastScanner();
		int t=sc.nextInt();
		while(t-->0) {
			int n=sc.nextInt(),m=sc.nextInt();
			int a[]=sc.readArray(n);
			ruffleSort(a);
			boolean isAns=false;
			double ans=0.00;
			for(int i=0;i<n;i++) {
				for(int j=i;j<n;j++) {
					ans+=(double)a[j]/(double)(j+1);
//					System.out.println(ans);
				}

			}
			if(ans==m) {
				isAns=true;
			}
			System.out.println(isAns?"YES":"NO");

		}
		}
		catch(Exception e) {
			return ;
		}

	}

	public static class Pair<L,R> {
	    private L l;
	    private R r;
	    public Pair(L l, R r){
	        this.l = l;
	        this.r = r;
	    }
	    public L getL(){ return l; }
	    public R getR(){ return r; }
	    public void setL(L l){ this.l = l; }
	    public void setR(R r){ this.r = r; }
	}

	static final Random random=new Random();

	static void ruffleSort(int[] a) {
		int n=a.length;
		for(int i=0;i<n;i++) {
			int oi=random.nextInt(n),temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}

	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                      st=new StringTokenizer(br.readLine());
                              } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a=new long[n];
			for(int i=0; i<n ; i++) a[i]=nextLong();
			return a;
		}

		String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
	}

}


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

public class A{
	public static void main(String[] args)  throws IOException,NumberFormatException{
		try {
		FastScanner sc=new FastScanner();
		int t=sc.nextInt();
		while(t-->0) {
			int n=sc.nextInt(),m=sc.nextInt();
			int a[]=sc.readArray(n);
			long sum=0;
			for(int i=0;i<n;i++) {
				sum+=a[i];
			}
			System.out.println(sum==m?"YES":"NO");

		}
		}
		catch(Exception e) {
			return ;
		}

	}

	public static class Pair<L,R> {
	    private L l;
	    private R r;
	    public Pair(L l, R r){
	        this.l = l;
	        this.r = r;
	    }
	    public L getL(){ return l; }
	    public R getR(){ return r; }
	    public void setL(L l){ this.l = l; }
	    public void setR(R r){ this.r = r; }
	}

	static final Random random=new Random();

	static void ruffleSort(int[] a) {
		int n=a.length;
		for(int i=0;i<n;i++) {
			int oi=random.nextInt(n),temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}

	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                      st=new StringTokenizer(br.readLine());
                              } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a=new long[n];
			for(int i=0; i<n ; i++) a[i]=nextLong();
			return a;
		}

		String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
	}

}


/**
 * Date: 14 Nov, 2020
 * Link: https://codeforces.com/contest/1436/problem/A
 *
 * @author: Prasad Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class A_1436 {

    public static void main(String[] args) throws IOException {
        FastIO in = new FastIO(args);
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            int m = in.ni();
            long sum = 0;
            for (int i = 0; i < n; i++)
                sum += in.ni();
            System.out.println(sum == m ? "Yes" : "no");
        }
        in.bw.flush();
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO(String[] args) throws IOException {
            if (args.length > 1) {
                br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(args[0]))));
                bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(args[1]))));
            } else {
                br = new BufferedReader(new InputStreamReader(System.in));
                bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            }
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class _0155Reorder {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int cases=sc.nextInt();
		while(cases>0) {
			int n=sc.nextInt();
			int m=sc.nextInt();
			int sum=0;
			for(int i=0;i<n;i++) {
				sum+=sc.nextInt();
			}
			System.out.println(sum==m?"YES":"NO");
			cases--;
		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Codeforces {
    static void reorder(int[] arr, int n, int m) {

        Arrays.sort(arr);
        float res = 0l;
        for ( int i = 0; i < n; i++) {
            for ( int j = i; j < n; j++) {
                res += (((float)arr[j])/((float)(j+1)));
            }
        }

        if (java.lang.Math.round(res) == m)
            System.out.println("Yes");
        else
            System.out.println("No");
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int testCases = Integer.parseInt(sc.nextLine());

        for ( int i = 0; i < testCases; i++) {
            String[] nm = sc.nextLine().split(" ");

            int n = Integer.parseInt(nm[0]);
            int m = Integer.parseInt(nm[1]);

            int[] arr = new int[n];
            String[] input = sc.nextLine().split(" ");
            for (int j = 0; j < input.length; j++)
                arr[j] = Integer.parseInt(input[j]);

            reorder(arr, n, m);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Codeforces {
    static void reorder(int[] arr, int n, int m) {

//        Arrays.sort(arr);
//        float res = 0l;
//        for ( int i = 0; i < n; i++) {
//            for ( int j = i; j < n; j++) {
//                res += (((float)arr[j])/((float)(j+1)));
//            }
//        }

        if (Arrays.stream(arr).sum() == m)
            System.out.println("Yes");
        else
            System.out.println("No");
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int testCases = Integer.parseInt(sc.nextLine());

        for ( int i = 0; i < testCases; i++) {
            String[] nm = sc.nextLine().split(" ");

            int n = Integer.parseInt(nm[0]);
            int m = Integer.parseInt(nm[1]);

            int[] arr = new int[n];
            String[] input = sc.nextLine().split(" ");
            for (int j = 0; j < input.length; j++)
                arr[j] = Integer.parseInt(input[j]);

            reorder(arr, n, m);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Codeforces {
    static void reorder(int[] arr, int n, int m) {

        Arrays.sort(arr);
        float res = 0l;
        for ( int i = 0; i < n; i++) {
            for ( int j = i; j < n; j++) {
                res += (((float)arr[j])/((float)(j+1)));
            }
        }

        System.out.println(java.lang.Math.round(res));
        if (java.lang.Math.round(res) == m)
            System.out.println("Yes");
        else
            System.out.println("No");
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int testCases = Integer.parseInt(sc.nextLine());

        for ( int i = 0; i < testCases; i++) {
            String[] nm = sc.nextLine().split(" ");

            int n = Integer.parseInt(nm[0]);
            int m = Integer.parseInt(nm[1]);

            int[] arr = new int[n];
            String[] input = sc.nextLine().split(" ");
            for (int j = 0; j < input.length; j++)
                arr[j] = Integer.parseInt(input[j]);

            reorder(arr, n, m);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class A {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int test_case = fs.nextInt();
		for (int t = 0; t < test_case; t++) {
			int n = fs.nextInt();
			int m = fs.nextInt();
			int[] a = fs.readArray(n);
			int sum = 0;
			for (int x : a) {
				sum += x;
			}
			if(sum == m) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.util.Scanner;

public class A {
    static Scanner sc = new Scanner(System.in);
    static StringBuilder out = new StringBuilder();
    public static void main(String[] args){
        int t = sc.nextInt();
        while (t-->0){
            int n = sc.nextInt();
            int m = sc.nextInt();
            int sum = 0;
            for (int i=0;i<n;i++){
                 sum += sc.nextInt();
            }
            if (sum==m){
                out.append("YES\n");
            }else {
                out.append("NO\n");
            }
        }
        System.out.println(out);
    }
}


import java.util.Scanner;

public class A {
    static Scanner sc = new Scanner(System.in);
    static StringBuilder out = new StringBuilder();
    public static void main(String[] args){
        int t = sc.nextInt();
        while (t-->0){
            int n = sc.nextInt();
            int m = sc.nextInt();
            int sum = 0;
            for (int i=0;i<n;i++){
                 sum += sc.nextInt();
            }
            if (sum==m){
                out.append("YES\n");
            }else {
                out.append("NO\n");
            }
        }
    }
}


import java.io.*;
import java.util.Vector;

// Author- Prashant Gupta

public class A {
    public static void main(String[] args) throws IOException {
        // write your code here
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
//        Scanner sc = new Scanner(System.in);
        Reader sc = new Reader();
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[] a = new int[n];
            int sum = 0;
            for (int i = 0; i < a.length; i++) {
                a[i] = sc.nextInt();
                sum += a[i];
            }
            out.println(sum == m ? "YES" : "NO");
        }
        out.close();
    }

    /*-------------------------------------------------------------------------------------*/

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long power(long x, long y) {
        long res = 1;
        while (x > 0) {
            if (y % 2 == 0) {
                x *= x;
                y /= 2;
            } else {
                res *= x;
                y--;
            }
        }
        return res;
    }

    public static long lcm(long x, long y) {
        return (x * y) / gcd(x, y);
    }

    public static int lowerBound(Vector<Integer> v, int e) {
        int start = 0, end = v.size() - 1, ind = -1;
        while (start <= end) {
            int mid = (start + end) / 2;
            if (v.get(mid) == e) {
                ind = mid;
                break;
            } else if (v.get(mid) < e) {
                ind = mid + 1;
                start = mid + 1;
            } else {
                end = mid - 1;
            }
        }
        return ind;
    }

    // Fast I/p

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }
}


import java.util.Scanner;
import java.util.Arrays;
import java.lang.*;
import java.io.*;
import java.util.*;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.*;
import java.util.function.Function;
import java.util.stream.IntStream;

public class ReOrder {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
       int t = sc.nextInt();
       for(int j = 0;j<t;j++){
           int n = sc.nextInt();
           int m = sc.nextInt();
           int[] arr = new int[n];
               for(int i=0;i<n;i++){
                   arr[i] = sc.nextInt();
               }
           System.out.println(solve(arr,m) ? "YES" : "NO");
       }

		sc.close();
	}
	public static boolean solve(int[] arr , int m){

	  return  Arrays.stream(arr).sum() == m;
	}

}


/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */
import java.util.*;
public class Main {
   public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
      int t;
      t = in.nextInt();
      while(t-->0)
      {
         int n, m;
         n = in.nextInt();
         m = in.nextInt();
         long s =0L;
         int a[]= new int[n];

         for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            s+=a[i];
         }
         if(s==m)
            System.out.println("YES");
         else
            System.out.println("NO");
      }
   }
}


package codes;

import java.util.Scanner;
import java.io.PrintWriter;

public class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        testNumber = in.nextInt();
        while(testNumber-->0)
        {
            int n, m;
            n = in.nextInt();
            m = in.nextInt();
            long s =0L;
            int a[]= new int[n];

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                s+=a[i];
            }
            if(s==m)
                out.println("YES");
            else
                out.println("NO");
        }
    }
}


package codes;

import java.util.Scanner;
import java.io.PrintWriter;

public class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        testNumber = in.nextInt();
        while(t-->0)
        {
            int n, m;
            n = in.nextInt();
            m = in.nextInt();
            long s =0L;
            int a[]= new int[n];

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                s+=a[i];
            }
            if(s==m)
                out.println("YES");
            else
                out.println("NO");
        }
    }
}


package codes;

import java.util.Scanner;
import java.io.PrintWriter;

public class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int t;
        t = in.nextInt();
        while(t-->0)
        {
            int n, m;
            n = in.nextInt();
            m = in.nextInt();
            long s =0L;
            int a[]= new int[n];

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                s+=a[i];
            }
            if(s==m)
                out.println("YES");
            else
                out.println("NO");
        }
    }
}


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

public class Main
 {
	public static void main (String[] args) throws Exception
	 {
     	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
     	int t = Integer.parseInt(br.readLine());
     	while(t-- > 0){
     	    String nums[] = br.readLine().split(" ");
            int n = Integer.parseInt(nums[0]);
            int m = Integer.parseInt(nums[1]);
            String num[] = br.readLine().split(" ");
            long sum = 0;
            for(int i = 0; i<n; i++){
                int number = Integer.parseInt(num[i]);
                sum += number;
            }
            if(sum==(long)m)
                pw.println("YES");
            else
                pw.println("NO");
     	}
        pw.flush();
	 }
}


import java.util.*;
public class Reorder {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0) {
			int n=sc.nextInt();
			int m=sc.nextInt();
			long sum=0;
			for(int i=0;i<n;i++) {
				long curr=sc.nextLong();
				sum=sum+curr;
			}

			if(sum==m) System.out.println("YES");
			else System.out.println("NO");
		}
	}

}


import java.lang.*;
import java.util.*;
import java.io.*;
// import java.io.BufferedReader;
// import java.io.IOException;
// import java.io.InputStreamReader;

 public class Main {

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args)throws java.lang.Exception {
         FastReader sc = new FastReader();
        // Scanner sc=new Scanner(System.in);
         StringBuffer sb = new StringBuffer();
            ArrayList<Integer> al=new ArrayList<>();
        ArrayList<Integer> b=new ArrayList<>();
            // Set<Integer> x=new HashSet<>();
        //    Set<Integer> y=new HashSet<>();

        int t=sc.nextInt();
        while(t-->0)
        {
         int n=sc.nextInt();
         int m=sc.nextInt();
         int[] a=new int[n+1];
         int sum=0;
         for(int i=1;i<=n;i++ )
        { a[i]=sc.nextInt();
            sum+=a[i];
            }

         if(sum==m)
         System.out.println("YES");
         else
         System.out.println("NO");

        }

}

}


import java.sql.Array;
import java.sql.ClientInfoStatus;
import java.text.CollationElementIterator;
import java.util.*;

public class codechef {
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int t = 0;
        if (sc.hasNext())
            t = sc.nextInt();
        for (int i = 1; i <= t; i++) {
            solve();
        }
    }

    public static void solve() {
        int n = sc.nextInt();
        int sum = 0;
        int m = sc.nextInt();
        for (int i = 0; i < n; i++) {
            sum += sc.nextInt();
        }
        if (sum==m){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}


// Dummy text
import java.io.*;
import java.util.*;
  public class Problem_A
  {
    public static void main(String[] args) throws IOException
    {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int t = Integer.parseInt(br.readLine());
       while (t-- > 0)
       {
           String line = br.readLine();
            String[] strs = line.trim().split("\\s+");
           int n = Integer.parseInt(strs[0]);
           int k = Integer.parseInt(strs[01]);
           int arr[] = new int[n];
           // to read multiple integers line
             line = br.readLine();
             strs = line.trim().split("\\s+");
            // array elements input
            long sum1=0;
            for (int i = 0; i < n; i++)
            {
            arr[i] = Integer.parseInt(strs[i]);
            sum1+=arr[i];
        }
        if(sum1==k)
        System.out.println("YES");
        else
         System.out.println("NO");
       }
        }
    }


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

public class Main {
	static InputReader scn = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);

	public static void main(String[] args) {

		// TODO Auto-generated method stub
		int t = scn.nextInt();
		while (t-- > 0)
			solve();
		out.close();
	}

	public static void solve() {
		int n = scn.nextInt();
		int m = scn.nextInt();
		int[] arr = scn.readArrays(n);
		Arrays.sort(arr);
		int ans = 0;
		for (int i = 0; i < n; i++) {
			ans += arr[i];
		}
//		out.println("ans : " + ans);
		if (ans == m)
			out.println("YES");
		else
			out.println("NO");
	}

	static final Random random = new Random();

	static void ruffleSort(int[] a) {
		int n = a.length;// shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a);
	}

	public static int binarySearch(int arr[], int l, int r, int x) {
		if (r >= l) {
			int mid = l + (r - l) / 2;
			if (arr[mid] == x)
				return mid;
			if (arr[mid] > x)
				return binarySearch(arr, l, mid - 1, x);
			return binarySearch(arr, mid + 1, r, x);
		}
		return -1;
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int[] readArrays(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = scn.nextInt();
			}
			return arr;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return nextLine();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0) {
					writer.print(' ');
					// writer.print(1);
				}
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}


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

public class Main {
	static InputReader scn = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);

	public static void main(String[] args) {

		// TODO Auto-generated method stub
		int t = scn.nextInt();
		while (t-- > 0)
			solve();
		out.close();
	}

	public static void solve() {
		int n = scn.nextInt();
		int m = scn.nextInt();
		int[] arr = scn.readArrays(n);
		Arrays.sort(arr);
		double ans = 0;
		for (int i = 0; i < n; i++) {
			for (int j = i; j < n; j++) {
				int val = j + 1;
				ans += (double) arr[j] / val;
			}
		}
		if (ans <= m)
			out.println("YES");
		else
			out.println("NO");
	}

	static final Random random = new Random();

	static void ruffleSort(int[] a) {
		int n = a.length;// shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a);
	}

	public static int binarySearch(int arr[], int l, int r, int x) {
		if (r >= l) {
			int mid = l + (r - l) / 2;
			if (arr[mid] == x)
				return mid;
			if (arr[mid] > x)
				return binarySearch(arr, l, mid - 1, x);
			return binarySearch(arr, mid + 1, r, x);
		}
		return -1;
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int[] readArrays(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = scn.nextInt();
			}
			return arr;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return nextLine();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0) {
					writer.print(' ');
					// writer.print(1);
				}
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Codeforces_Reorder {
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cases = Integer.parseInt(br.readLine());
        int i,j;
        while(cases>0){
            String[] stats = br.readLine().split(" ");
            int n = Integer.parseInt(stats[0]);
            double m = Double.parseDouble(stats[1]);
            String Values[] = br.readLine().split(" ");
            double[] values = new double[n];
            for(i=0; i<n; i++)
                values[i] = Double.parseDouble(Values[i]);
            Arrays.sort(values);
            double total = 0;
            for(i=0;i<n;i++){
                for (j=i;j<n;j++){
                    total+=(values[j]/(j+1));
                }
            }
            if(total<=m)
                System.out.println("YES");
            else
                System.out.println("NO");
            cases-=1;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Codeforces_Reorder {
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cases = Integer.parseInt(br.readLine());
        int i,j;
        while(cases>0){
            String[] stats = br.readLine().split(" ");
            int n = Integer.parseInt(stats[0]);
            long m = Integer.parseInt(stats[1]);
            String Values[] = br.readLine().split(" ");
            long total=0;
            for(i=0; i<n; i++)
                total+= Integer.parseInt(Values[i]);
            if(total==m)
                System.out.println("YES");
            else
                System.out.println("NO");
            cases-=1;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Codeforces_Reorder {
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cases = Integer.parseInt(br.readLine());
        int i,j;
        while(cases>0){
            String[] stats = br.readLine().split(" ");
            int n = Integer.parseInt(stats[0]);
            double m = Double.parseDouble(stats[1]);
            String Values[] = br.readLine().split(" ");
            double[] values = new double[n];
            for(i=0; i<n; i++)
                values[i] = Double.parseDouble(Values[i]);
            Arrays.sort(values);
            double total = 0;
            for(i=0;i<n;i++){
                for (j=i;j<n;j++){
                    total+=(values[j]/(j+1));
                }
            }
            if(total==m)
                System.out.println("YES");
            else
                System.out.println("NO");
            cases-=1;
        }
    }
}


import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class JavaTest {
    private static PrintWriter out = new PrintWriter(System.out);
    private static Scanner sc;

    public static void main(String args[]) throws Exception {
        InputStream is = JavaTest.class.getResourceAsStream("in.txt");
        boolean testMode = is != null;
        sc = new Scanner(testMode ? is : System.in);

        long start = System.currentTimeMillis();
        main();

        if (testMode) {
            out.println();
            out.print(System.currentTimeMillis() - start + " ms");
        }

        out.close();
    }

    private static void main() throws Exception {
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int arr[] = new int[n];
            int sum = 0;
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                sum += arr[i];
            }
            System.out.println(sum == m ? "YES" : "NO");
        }
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

/* code by aman */

public class RecordCodeForces
{
	public static void main (String[] args)
	{

			FastReader scan = new FastReader();
            PrintWriter out = new PrintWriter(System.out);
            Task solver = new Task();
            int testcase = scan.nextInt();
            for(int tt = 1; tt <= testcase ; tt++) solver.solve(tt, scan, out);
            out.close();

	}
// main code in task
	  static class Task {

            public void solve(int testNumber, FastReader scan, PrintWriter out) {
                int n = scan.nextInt();
                int m = scan.nextInt();
                int[] arr = new int[n];
                int temp = 0;
                for(int i = 0; i < n; i++){
                	arr[i] = scan.nextInt();
                	temp +=arr[i];
                }

                if(temp == m ) out.println("YES");
                else out.println("NO");

            }
        }

 static class FastReader {
            BufferedReader br;
            StringTokenizer st;

            public FastReader() {
                br = new BufferedReader(new InputStreamReader(System.in));
            }

            public FastReader(String s) throws FileNotFoundException {
                br = new BufferedReader(new FileReader(new File(s)));
            }

            String next() {
                while (st == null || !st.hasMoreElements()) {
                    try {
                        st = new StringTokenizer(br.readLine());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                return st.nextToken();
            }

            int nextInt() {
                return Integer.parseInt(next());
            }

            long nextLong() {
                return Long.parseLong(next());
            }

            double nextDouble() {
                return Double.parseDouble(next());
            }

            String nextLine() {
                String str = "";
                try {
                    str = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return str;
            }
        }
 }


import java.io.*;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

/* code by aman */

public class RecordCodeForces
{
	public static void main (String[] args)
	{

			FastReader scan = new FastReader();
            PrintWriter out = new PrintWriter(System.out);
            Task solver = new Task();
            int testcase = scan.nextInt();
            for(int tt = 1; tt <= testcase ; tt++) solver.solve(tt, scan, out);
            out.close();

	}
// main code in task
	  static class Task {

            public void solve(int testNumber, FastReader scan, PrintWriter out) {
                int n = scan.nextInt();
                int m = scan.nextInt();
                int[] arr = new int[n];
                int temp = 0;
                for(int i = 0; i < n; i++){
                	arr[i] = scan.nextInt();
                	temp +=temp;
                }

                if(temp == m ) out.println("YES");
                else out.println("NO");

            }
        }

 static class FastReader {
            BufferedReader br;
            StringTokenizer st;

            public FastReader() {
                br = new BufferedReader(new InputStreamReader(System.in));
            }

            public FastReader(String s) throws FileNotFoundException {
                br = new BufferedReader(new FileReader(new File(s)));
            }

            String next() {
                while (st == null || !st.hasMoreElements()) {
                    try {
                        st = new StringTokenizer(br.readLine());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                return st.nextToken();
            }

            int nextInt() {
                return Integer.parseInt(next());
            }

            long nextLong() {
                return Long.parseLong(next());
            }

            double nextDouble() {
                return Double.parseDouble(next());
            }

            String nextLine() {
                String str = "";
                try {
                    str = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return str;
            }
        }
 }


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

// Standard Input fisrt line test case then Size of array
// then As a string all character of Array

/* Name of the class has to be "Main" only if the class is public. */
public class RecordCodeForces
{
	public static void main (String[] args)
	{
			Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();

		while(t-->0){

			int n = sc.nextInt();
			int m = sc.nextInt();

			int[] ar = new int[n];

			for(int i = 0 ; i < n ;i++ ){
				ar[i] = sc.nextInt();
			}

		Arrays.sort(ar);

		System.out.println(solver(ar,ar.length,m));

	}

	}

	public static String solver(int[] arr , int len ,int m){

		int tempAns = 0 ;
		for (int i =0  ;i < len ;i++ ) {

		for(int j = i; j < len ;j++){

			tempAns += arr[j];

		}

		}

		String p = "YES";
		String q = "NO";
		if(tempAns <= m ) return p;
		else return q;

	}
}


package cf_round678;

import java.io.*;
import java.util.*;
import java.util.Scanner;

public class A {

	public static class pair implements Comparable<pair> {
		int f;
		int s;

		pair(int x, int y) {

			f = y;
			s = x;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.s - o.s;
		}
	}

	static int mod = (int) 1e9 + 7;
	static ArrayList<Integer> gr[];
	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	int n;

	public static void main(String[] args) throws IOException {
		int t = sc.nextInt();

		while (t-- > 0) {

			int n=sc.nextInt();
			int m=sc.nextInt();
			int a[]=new int[n];

			int sum=0;
			for(int i=0;i<n;i++) {

				a[i]=sc.nextInt();
			    sum+=a[i];

			}

			if(sum==m)out.append("YES\n");else out.append("NO\n");

		}

		System.out.println(out);
	}

}


import java.io.*;
import java.util.*;
import java.util.Scanner;

public class A {

	public static class pair implements Comparable<pair> {
		int f;
		int s;

		pair(int x, int y) {

			f = y;
			s = x;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.s - o.s;
		}
	}

	static int mod = (int) 1e9 + 7;
	static ArrayList<Integer> gr[];
	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	int n;

	public static void main(String[] args) throws IOException {
		int t = sc.nextInt();

		while (t-- > 0) {

			int n=sc.nextInt();
			int m=sc.nextInt();
			int a[]=new int[n];

			int sum=0;
			for(int i=0;i<n;i++) {

				a[i]=sc.nextInt();
			    sum+=a[i];

			}

			if(sum==m)out.append("YES\n");else out.append("NO\n");

		}

		System.out.println(out);
	}

}


import java.io.*;
import java.util.*;
import java.util.stream.Stream;

public class Solution {

    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
      int t=sc.nextInt();
      for(int i=0;i<t;i++) {
    	  int n=sc.nextInt(),b=sc.nextInt();
    	  int []arr=new int[n];
    	  long sum=0;
    	  for(int ii=0;ii<n;ii++) {
    		  sum+=arr[i];
    	  }
    	  if(sum==b) {
    		  System.out.println("YES");
    	  }
    	  else {
    		  System.out.println("NO");
    	  }
      }

    }
}


import java.io.*;
import java.util.*;
import java.util.stream.Stream;

public class Solution {

    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
      int t=sc.nextInt();
      for(int i=0;i<t;i++) {
    	  int n=sc.nextInt(),b=sc.nextInt();
    	  int []arr=new int[n];
    	  int sum=0;
    	  for(int ii=0;ii<n;ii++) {
    		  arr[ii]=sc.nextInt();
    		  sum+=arr[ii];
    	  }
    	  if(sum==b) {
    		  System.out.println("YES");
    	  }
    	  else {
    		  System.out.println("NO");
    	  }
      }

    }
}


import java.io.*;
import java.util.*;
import java.util.stream.Stream;

public class Solution {

    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
      int t=sc.nextInt();
      for(int i=0;i<t;i++) {
    	  int n=sc.nextInt(),b=sc.nextInt();
    	  int []arr=new int[n];
    	  long sum=0;
    	  for(int ii=0;ii<n;ii++) {
    		  sum+=arr[ii];
    	  }
    	  if(sum==b) {
    		  System.out.println("YES");
    	  }
    	  else {
    		  System.out.println("NO");
    	  }
      }

    }
}


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

public class Main {
	static final int M = 1000000007;
		static FastReader in = new FastReader();
		static PrintWriter out = new PrintWriter(System.out);
//		static Scanner in = new Scanner(System.in);
//        File file = new File("input.txt");
//        Scanner in = new Scanner(file);
//        PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
    public static void main(String[] args) {

    	int te = in.nextInt();
    	while(te-- > 0){
    		int sum = 0;
    		int n = in.nextInt(), m = in.nextInt();
    		for(int i = 0; i<n; i++) sum+= in.nextInt();
    		if(sum==m) {
    			out.println("YES");
    		}else out.println("NO");

    	}
    	out.close();
    }

    static int gcd(int a, int b) {
    	if(b==0) return a;
    	return gcd(b, a%b);
    }

	static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

public class Main {
	static final int M = 1000000007;
		static FastReader in = new FastReader();
		static PrintWriter out = new PrintWriter(System.out);
//		static Scanner in = new Scanner(System.in);
//        File file = new File("input.txt");
//        Scanner in = new Scanner(file);
//        PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
    public static void main(String[] args) {

    	int te = in.nextInt();
    	while(te-- > 0){
    		int sum = 0;
    		int n = in.nextInt(), m = in.nextInt();
    		for(int i = 0; i<n; i++) sum+= in.nextInt();
    		if(sum%m==0) {
    			out.println("YES");
    		}else out.println("NO");

    	}
    	out.close();
    }

    static int gcd(int a, int b) {
    	if(b==0) return a;
    	return gcd(b, a%b);
    }

	static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

public class Main {
	static final int M = 1000000007;
		static FastReader in = new FastReader();
		static PrintWriter out = new PrintWriter(System.out);
//		static Scanner in = new Scanner(System.in);
//        File file = new File("input.txt");
//        Scanner in = new Scanner(file);
//        PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
    public static void main(String[] args) {

    	int t = in.nextInt();
    	while(t-- > 0){
    		double sum = 0;
    		int n = in.nextInt(), m = in.nextInt();
    		for(int i = 0; i<n; i++) sum+= in.nextInt();
    		if(Math.floor(sum/m)==Math.ceil(sum/m) && sum!=0) {
    			out.println("YES");
    		}else out.println("NO");

    	}
    	out.close();
    }

    static int gcd(int a, int b) {
    	if(b==0) return a;
    	return gcd(b, a%b);
    }

	static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.Scanner;
import java.lang.Math;
import java.util.HashMap;
import java.util.Arrays;
import java.util.Map;
import java.util.*;

public class Hello{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int i = 0; i<t; i++){
			int n = sc.nextInt(), m = sc.nextInt(), sum = 0;
			for(int j = 0; j<n;j++)
				sum+=sc.nextInt();
			System.out.println(sum == m? "YES" : "NO");
		}
	}
}


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

public class A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int sum = 0;
			for(int i = 0; i < n; i++) {
				int x = sc.nextInt();
				sum += x;
			}
			System.out.println(sum == m ? "YES" : "NO");
		}
	}
}


import com.sun.source.tree.Tree;

import javax.naming.spi.DirObjectFactory;
import javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.nio.file.LinkOption;
import java.util.*;

public class Main {

   static boolean vis[][];
   static boolean vis2[][];
   static char[][]a;
   static boolean reach(int row,int col,int type){
        if (row>=vis.length||col>=vis.length)return false;
        if (a[row][col]=='F')return true;
        if (vis[row][col]||(a[row][col]!='S'&&(a[row][col]-'0')!=type))return false;
        vis[row][col]=true;
        boolean state=false;
       state|= reach(row+1,col,type);
        state|=reach (row,col+1,type);
        return state;
    }

    static boolean reach2(int row,int col,int type){
        if (row>=vis2.length||col>=vis2.length)return false;
        if (a[row][col]=='F')return true;

        if (vis2[row][col]||(a[row][col]!='S'&&(a[row][col]-'0')!=type))return false;
        vis2[row][col]=true;
        boolean state = reach2(row + 1, col, type);
        state|=reach2(row,col+1,type);
        return state;
    }

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);

        try (PrintWriter or = new PrintWriter(System.out)) {

            int t = in.nextInt();
            outer:
            while (t-- > 0) {

               int n = in.nextInt();
                int m=in.nextInt();
                int ans=0;
                for (int i = 0; i < n; i++) {
                    ans+=in.nextInt();
                }
                or.println(ans==m?"YES":"NO");

            }
        }

    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

}


package cf;

import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	static private Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int t = sc.nextInt();

		while(t > 0) {
			t -= 1;

			int n = sc.nextInt(), m = sc.nextInt();

			int acc = 0;
			for(int i = 0; i < n; i++) {
				acc += sc.nextInt();
			}

			if(acc == m) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		}

	}
}


import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	static private Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int t = sc.nextInt();

		while(t > 0) {
			t -= 1;

			int n = sc.nextInt(), m = sc.nextInt();

			int acc = 0;
			for(int i = 0; i < n; i++) {
				acc += sc.nextInt();
			}

			if(acc == m) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		}

	}
}


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

public class A{

    public static Scanner sc = new Scanner(System.in);

    public static int t;
    public static int n,m;
    public static int[] A;
    public static String[] s;

    public static void Input(){
        t = sc.nextInt();
    }

    public static void Solve(){
        for (int i=0; i<t; i++){
            n = sc.nextInt();
            m = sc.nextInt();
            A = new int[n];
            int sum = 0;
            for (int j=0; j<n; j++){
                A[j] = sc.nextInt();
                sum = sum + A[j];
            }

            String s;
            if (sum==m)
                s = "YES";
            else s = "NO";
            System.out.println("Case #" + (i+1) + ": " + s);
        }
    }

    public static void main(String args[]){
        Input();
        Solve();
    }

}


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

public class A{

    public static Scanner sc = new Scanner(System.in);

    public static int t;
    public static int n,m;
    public static int[] A;
    public static String[] s;

    public static void Input(){
        t = sc.nextInt();
    }

    public static void Solve(){
        for (int i=0; i<t; i++){
            n = sc.nextInt();
            m = sc.nextInt();
            A = new int[n];
            int sum = 0;
            for (int j=0; j<n; j++){
                A[j] = sc.nextInt();
                sum = sum + A[j];
            }

            String s;
            if (sum==m)
                s = "YES";
            else s = "NO";
            System.out.println(s);
        }
    }

    public static void main(String args[]){
        Input();
        Solve();
    }

}


 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Arrays;
 import java.util.Scanner;
 import java.util.StringTokenizer;

 public class  R_678_1
 {
     public static void main(String[] args) throws IOException {
         try {

             BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
             //Scanner sc=new Scanner(System.in);

             int i, m = 0, sum = 0, testcases, n = 0;

             testcases = Integer.parseInt(br.readLine());

             while (testcases-- > 0) {
                 i = 0;
                 StringTokenizer st1 = new StringTokenizer(br.readLine());// FOR SPACED INPUTS
                 while (st1.hasMoreTokens()) {
                     n = Integer.parseInt(st1.nextToken());
                     m = Integer.parseInt(st1.nextToken());

                 }

                 int[] arr = new int[n];

                 StringTokenizer st2 = new StringTokenizer(br.readLine());// FOR SPACED INPUTS
                 while (st2.hasMoreTokens()) {
                     arr[i] = Integer.parseInt(st2.nextToken());
                     sum += arr[i];
                     i++;

                 }
                 if (sum == m)
                     System.out.println("YES");
                 else
                     System.out.println("NO");

             }
         }
         catch (Exception e)
         {
             return;
         }

     }
 }


 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Arrays;
 import java.util.Scanner;
 import java.util.StringTokenizer;

 public class  R_678_1
 {
     public static void main(String[] args) throws IOException {
         try {

             BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
             //Scanner sc=new Scanner(System.in);

             int i, m = 0, sum = 0, testcases, n = 0;

             testcases = Integer.parseInt(br.readLine());

             while (testcases-- > 0) {
                 i = 0;sum = 0;
                 StringTokenizer st1 = new StringTokenizer(br.readLine());// FOR SPACED INPUTS
                 while (st1.hasMoreTokens()) {
                     n = Integer.parseInt(st1.nextToken());
                     m = Integer.parseInt(st1.nextToken());

                 }

                 int[] arr = new int[n];

                 StringTokenizer st2 = new StringTokenizer(br.readLine());// FOR SPACED INPUTS
                 while (st2.hasMoreTokens()) {
                     arr[i] = Integer.parseInt(st2.nextToken());
                     sum += arr[i];
                     i++;

                 }
                 if (sum == m)
                     System.out.println("YES");
                 else
                     System.out.println("NO");

             }
         }
         catch (Exception e)
         {
             return;
         }

     }
 }