def get_indices_of_A_in_B(A, B):
    """Return the set of indices into B of the elements in A that occur in B
    
    Parameters
    ----------
    A : list
        The "needles"
    B : list
        The "haystack"
    Returns
    -------
    list
        Indices into B of elements in A occuring in B
    """
    s = set(B)
    return [i for i, e in enumerate(A) if e in s]