Help me in solving ONEDIF problem

My issue

In the third test case of [2 1 5 2], if we replaced ‘2’ with ‘4’ then the div-mex can be ‘3’
but the explanation mentions that ‘4’ is optimal, can anyone please explain why ?

My code

t = int(input())

while t:
    n, m = map(int, input().split())
    arr = list(map(int, input().split()))
    
    
    num = 2
  
    while True:
        for i in arr:
            if i % num == 0:
                num += 1
                break
        else:
            print(num+1)
            break
        
    
    t-=1 

Problem Link: MEXtreme Divisibility Practice Coding Problem