n, m = map(int, input().split())
costs = list(map(int, input().split()))
possible_costs = set()
for i in range(m - n + 1):
   total_cost = sum(costs[i:i + n])
   possible_costs.add(total_cost)
possible_costs = sorted(list(possible_costs))
k = len(possible_costs)
print(k)
print(*possible_costs)