Find enclosing elements in array