// Arup Guha
// 1/16/2017
// Solution to 2014 NAQ Problem C: Flexible Spaces

import java.util.*;

public class flexiblespaces {

	public static void main(String[] args) {

		// Read in all the dividers, adding in 0 and n in sorted order.
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		ArrayList<Integer> dividers = new ArrayList<Integer>();
		dividers.add(0);
		int numDiv = stdin.nextInt();
		for (int i=0; i<numDiv; i++)
			dividers.add(stdin.nextInt());
		dividers.add(n);

		// Brute force since bounds are small.
		boolean[] good = new boolean[n+1];
		for (int i=0; i<dividers.size(); i++)
			for (int j=i+1; j<dividers.size(); j++)
				good[dividers.get(j)-dividers.get(i)] = true;

		// Just in case they are annoying about format.
		boolean printed = false;

		// Go through each possibility.
		for (int i=1; i<=n; i++) {

			// These are the ones we print.
			if (good[i]) {
				if (printed) System.out.print(" ");
				printed = true;
				System.out.print(i);
			}
		}
		System.out.println();
	}
}