import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Solution to Who Goes There?
 * 
 * @author vanb
 */
public class whogoesthere_vanb
{
    /** Input. */
    private static Scanner sc;
    
    /** Output. */
    private static PrintStream ps;
    
    /**
     * Do it!
     */
    private void doit()
    {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int teams[] = new int[m];
        for( int i=0; i<m; i++ ) teams[i] = sc.nextInt();
        
        int accepted[] = new int[m];
        Arrays.fill( accepted, 0 );
        
        int school = 0;
        
        while( n>0 && m>0 )
        {
            if( accepted[school] < teams[school] )
            {
                accepted[school]++;
                --n;
                if( accepted[school]==teams[school] ) --m;
            }
            school = (school+1)%teams.length;
        }
        
        for( int a : accepted ) ps.println( a );
    }
        
    /**
     * Main.
     * 
     * @param args unused
     * @throws Exception
     */
    public static void main( String[] args ) throws Exception
    {
        sc = new Scanner( System.in );
        ps = System.out;
        
        new whogoesthere_vanb().doit();
    }

}
