def find_possible_room_cost(n, m, costs):
  min_cost = float('inf')
  max_cost = -float('inf')

  
  for i in range(0, m, n):
      cost = sum(costs[i:i+n])
      min_cost = min(min_cost, cost)
      max_cost = max(max_cost, cost)

  possible_costs = set()


  for i in range(1, int(max_cost) + 1):
      if max_cost % i == 0:
          is_possible = True
          current_cost = i
          for j in range(n):
              daily_cost = sum(costs[j::n])
              if daily_cost != current_cost:
                  is_possible = False
                  break
              current_cost += i
          if is_possible:
              possible_costs.add(i)

  return len(possible_costs), list(possible_costs)

n, m = map(int, input().split())
costs = list(map(int, input().split()))

k, possible_costs = find_possible_room_cost(n, m, costs)

print(k)
print(" ".join(map(str, possible_costs)))


