You need to grab the X and the value from the first array, then you run an 'array 2 contains value', this gives you 3 if it returns false. If true, then you run the further check, find the X of the passed value in the second array, if it matches the passed X from array 1 then returns 1 else it's 2.