def check_possible_values(n, m, services, target_total_cost):
    left, right = 1, max(services)
    possible_values = []
    
    while left <= right:
        x = (left + right) // 2
        total_cost = 0
        
        for cost in services:
            total_cost += min(x, cost)
        
        if total_cost == target_total_cost:
            possible_values.append(x)
            left = x + 1
        elif total_cost < target_total_cost:
            left = x + 1
        else:
            right = x - 1
    
    return possible_values

n, m = map(int, input().split())
services = list(map(int, input().split()))
total_cost = sum(services)

possible_values = check_possible_values(n, m, services, total_cost)
print(len(possible_values))
print(*possible_values)
