Checks whether an element is in an array