#include <stdio.h>

int main(int argc, const char * argv[]) {
    int reg = 99999;
    int i,j;
    int n,m;
    int data[300000][2];
    int data_m[100000];
    scanf("%d %d",&n,&m);
    
    for (i = 0; i < m; i++) {
        scanf("%d",&data_m[i]);
    }
    
    for (i = 0; i < n; i++) {
        data[i+reg][0] = i+1;
    }
    
    for (i = 0; i < reg+n; i++) {
        data[i][1] = 1;
    }
    
    for (i = 0; i < m; i++) {
        
        //?????????????????????????????????????????????????????????
        if (data_m[i] == data[data_m[i]-1][0] && data[data_m[i]-1][1] == 1) {
            //???????????£?????????
            data[reg-1 - i][0] = data_m[i]-1;
            //?§????????????????????´?????????????
            data[data_m[i]-1][0] = reg-1-i;
            data[data_m[i]-1][1] = 0;
        } else { //???????????\???????????§?????´???
            int x = reg+data_m[i]-1;
            
            printf("\n\n%d\n\n",x);
            while(1) {
                
                if (data_m[i] == data[x][0] && data[x][1] == 1) {
                    data[reg-1 - i][0] = data[x][0];
                    data[x][0] = reg-1-i;
                    data[x][1] = 0;
                    break;
                }
                x = data[x][0];
            }
            
            
        }
    }
    
    for (i = reg - m ; i < reg+n; i++) {
        if (data[i][1] == 1) {
            //printf("%d %d\n",data[i][0],data[i][1]);
            printf("%d\n",data[i][0]);
        }
    }
    return 0;
}