Ah I understand better, you're describing different figure cases, and indeed case 2 is a bit more complex, what you can do is, instead of using For Each Element, use a For loop and use its loopindex to look through the values of the first array, and for each of these values, run another For loop through the second array, and if any of the values it contains is equal to array value at first For loopindex, stop the loop and trigger an event;
I guess an example would be easier to understand, I'll give it a shot once at home