from typing import Counter


def sort(sequence, values):
    """
    Sort using the counting sort algorithm.
    
    sequence -- the sequence to sort
    values -- all the possible values of elements in the sequence
              (values must be in sorted order)
    
    Returns a list with the given sequence's elements in non-decreasing order.
    """
    count_per_value = Counter(sequence)
    result = []
    for value in values:
        result.extend([value] * count_per_value[value])
    return result