#include<bits/stdc++.h>
 using namespace std;
 #define ll long long int
 #define fo(i,n) for(int i=0;i<n;i++)
 #define vi vector<int>
 #define vll vector<ll>
 #define pii pair<int,int>
 #define pll pair<ll,ll>
 #define sfo(i,a,b) for(int i=a;i<=b;i++)  // for_range
 #define rfo(i,b,a) for(int i=b;i>=a;i--)  //for_reverse_range
 #define all(a) a.begin(), a.end()
 #define rall(a) a.rbegin(), a.rend()
 
 
 long long gcd(long long int a, long long int b)
 {
   if (b == 0)
     return a;
   return gcd(b, a % b);
 }
  
 // Function to return LCM of two numbers 
 long long lcm(int a, int b)
 {
     return (a / gcd(a, b)) * b;
 }
 
 
 int highestPowerof2(int n) 
 { 
    int p = (int)log2(n); 
    return (int)pow(2, p);  
 }
 
 int main() 
 { 
    
   
     int t; 
     cin >> t; 
     while (t--) { 

      ll q,d;
      cin>>q>>d;
      while(q--)
      {
          ll n;
          cin>>n;
          bool flag=false;

          if(n>(d*10))
          {
            cout<<"Yes"<<endl;
            continue;
          }
          else
          {
            while(n>0)
            {
               
               if(n%10==d)
                  flag=true;

                n-=d;
            }
          }

          if(flag==true)
            cout<<"Yes"<<endl;
          else
            cout<<"No"<<endl;

      }
     
   
  
     
       }
       return 0; 
 }   

  