I recently asked a question here: [How do I find if an int is in array of arrays?](https://stackoverflow.com/questions/14856837/how-do-i-find-if-an-int-is-in-array-of-arrays) and the solution works well. I'm trying to write code which will remove an int from an array if another array doesn't contain it. The loop I'm trying to use is:

```
for index in range(len(numbers)):
    if not any(numbers[index] in elem[:2] for elem in numbers2):
        numbers.remove(numbers[index])

```

Say `numbers = [1, 2, 4]` and `numbers2 = [[4,5,6], [2,8,9]]` then after the loop, numbers[] should be `numbers = [2, 4]`. The above loop however keeps producing the error `exceptions.IndexError: list index out of range` but I can't see why the error keeps being thrown. Could anyone help with this issue?