I have a question which i totally have no idea on how to start, so i am hoping for some hint, say like give me an idea on how many times i should compare for each element in A if u know?

Given two arrays A and B containing n and m integers respectively, determine the set of integers that occur in A and B. You may assume that n>m>5. Your solution must satisfy the following conditions:
(1)Let X be an element in A. In order to identify whether X occurs in B, you required to compare X with one or more elements in B. However, you MUST NOT compare X with all the elements in B;

(2) You are not allowed to sort the elements in A or B

eg:
A= [2, 8, 6, 15, 23, 12, 7]
B= [15, 10, 6, 31, 3, 4, 7]

Then the set of identical integers will be [6,7]