how to count negative number in an array? : In a hacker rank problem, i want to count the number of negative numbers. if the count is greater than an integer k,then I must print no.Else yes. I get runtime error. Is there any way to count faster?

my code goes

    public class Solution {
    
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        for(int l=0;l<t;l++)
        {
            int count=0;
          int k=s.nextInt();
          int n=s.nextInt();
          ArrayList<Integer> al=new ArrayList();
          for(int i=0;i<n;i++)
          {
              al.add(s.nextInt());
          }
          Collections.sort(al);
          for(int c:al)
          {
              if(c<=0)
              {
                  count+=1;
              }
              else
              break;
          }
          if((count>=k)||(count==k))
          {
              System.out.println("NO");
          }
          else
          {
              System.out.println("YES");
          }
         
    
    
        }
    }}


