let [| n; q |] = stdin.ReadLine().Split() |> Array.map int let xs = [| for i in 0 .. q - 1 -> stdin.ReadLine() |> int |] let f x = let cond1 = x % n = 0 let cond2 = (string x).Contains(string n) if cond1 || cond2 then "Yes" else "No" xs |> Array.map f |> String.concat "\n" |> printfn "%s"