I can't pass any test case

import java.util.*;
public class Aclass {
public static void main(String args[]) {
int a[]=new int[1000000];
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<n;i++){
int t=sc.nextInt();
if(a[t]==0){
a[t]=1;

		   }else{
			   a[t]=a[t]+1;
			   
		   }
	   }
       int sum[]=new int[1000000];
       for(int i=2;i<1000000;i++) {
    	   for(int j=i;j<1000000;j=j+i) {
    		   if(a[j]!=0) {
    			   sum[i]=sum[i]+a[j];
    		   }
    	   }
       }
    
	   int q=sc.nextInt();
	   while(q-->0){
		   int k=sc.nextInt();
	       System.out.println(sum[k]);
	   }
}

}

@Affan-Mokarram-202031887744398
Please send your code on CB IDE