import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {


    public static void reverse(int[] nums, int start, int end) {
        while (start < end) {
            int k = nums[start];
            nums[start] = nums[end];
            nums[end] = k;
            start++;
            end--;
        }

    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int k = scanner.nextInt();
            int[] moves = new int[k];
            int [] ans = new int[n];
            for (int i = 0; i < n; i++) {
                ans[i] = i + 1;
            }

            int mid = n / 2 - 1;
            for (int i = 0; i < k; i++) {
                moves[i] = scanner.nextInt();

                reverse(ans, 0, moves[i] - 1);
                reverse(ans, moves[i], n - 1);
                reverse(ans, 0, n - 1);
                reverse(ans, 0, mid);
            }

            for (int i = 0; i < n; i++) {
                System.out.print(ans[i] + " ");
            }
            System.out.println();



        }
    }
}