def first(a, k: int, axis: int = -1):
    """
    Returns the `k` first values of `a` along the specified axis.

    Parameters
    ----------
    a : ndarray
        Input array of values.

    k: int
        Number of values to return.
        Should be a positive integer not larger than `a` along `axis`.

    axis : int, default=-1
        The axis along which values are selected.

    Returns
    -------
    first_along_axis : ndarray
        An array with the same shape as `a`, with the specified axis reduced according to the value of `k`.
    """
    if k == a.shape[axis]:
        return a
    slc = [slice(None)] * len(a.shape)
    slc[axis] = slice(0, k)
    return a[tuple(slc)]