from typing import List


def permutation_to_front(n: int, entries: List[int]):
    """Build permutation that maps given ordered entries to the front.

    This function creates a permutation on n elements that leaves each
    element alone except for those in `entries`. Those entries are moved
    to the front (i.e. the left) in the order of the list `entries`.

    Examples:
        >>> permutation_to_front(5, [2])
        [2, 0, 1, 3, 4]
        >>> permutation_to_front(5, [2, 1])
        [2, 1, 0, 3, 4]

    Permutations in PyTorch reminder:
        While permutations are naturally specified with dicts, PyTorch and
        NumPy use will things ike [3, 0, 1, 2] to indicate that object 3
        should be moved to slot 0, object 0 should be moved to slot 1, etc.
    """
    entries = entries.copy()
    arrangement = list(range(n))
    for q in entries:
        del arrangement[arrangement.index(q)]
    return entries + arrangement