from typing import Counter


def most_common_and_other(values: list, max_categories, other_str='Others'):
    """
    Count categories in the values, if there are more than max_categories, sum up all others to other_str field
    Returns: List of most common elements ( [name, count_of_occur], [name_2, count_2], ..., ["Others", count_of_others])
    """
    provider_counter = Counter(values)
    total = sum(provider_counter.values())
    elements = provider_counter.most_common(max_categories)
    total_most_common = sum(item[1] for item in elements)
    others_sum = total - total_most_common
    elements.append((other_str, others_sum))
    return elements