// Arup Guha
// 3/5/2022
// Solution to 2021 SER D2 Problem: Who Goes There?

import java.util.*;

public class there {
	
	public static void main(String[] args) {

		// Get #teams, schools.
		Scanner stdin = new Scanner(System.in);
		int nTeams = stdin.nextInt();
		int nSchools = stdin.nextInt();

		int sumTeams = 0;
		int[] capacity = new int[nSchools];
		for (int i=0; i<nSchools; i++) {
			capacity[i] = stdin.nextInt();
			sumTeams += capacity[i];
		}
		
		// Will store result here.
		int[] res = new int[nSchools];
		int idx = 0;
			
		// Since # are so small, will do the slow way, team by team.
		int assigned = 0;
		for (int i=0;; i++) {
			
			// Who gets the next shot.
			int loc = i%nSchools;
				
			// Give them a team if they have one.
			if (res[loc] < capacity[loc]) {
				res[loc]++;
				assigned++;
			}
				
			// Get out!
			if (assigned == Math.min(nTeams, sumTeams)) break;
		}
		
		// Print # teams for each school.
		for (int i=0; i<nSchools; i++)
			System.out.println(res[i]);
	}
}