//
//  main.c
//  ACM-ICPC2016TSUKUBA
//
//  Created by x15071xx on 2016/10/18.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

#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++) {
        int j = reg + data_m[i] - 1;
        
        while (1) {
            //????????????????????????????§?????????????
            if (data_m[i] == data[j][0] && data[j][1] == 1) {
                data[reg - i -1][0] = data[j][0];
                data[j][0] = reg - i -1;
                data[j][1] = 0;
                break;
            }
            //?????§??????????????´???
            j = data[j][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;
}