def divide(elem_count, group_count):
    """Random divide elems into groups."""
    sizes = [elem_count // group_count] * group_count
    prefix = elem_count % group_count
    sizes[:prefix] = [elem_count // group_count + 1] * prefix
    return sizes
