list1 = <input1> list2 = <input2> result = new list for each element from list1 do: current = element for each element2 from list2 do: if current == element2 then: result.add(current) // далее просто останавливаем цикл по list2 break; return result