#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 20;   int a[105];   int u[105], res[105];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d , &a[i]);     }     int pos = a[0], ans = 1;     while (ans < m) {       if (a[ans] > pos) {         if (res[pos] == 0) {           if (u[a[ans] - pos]) {             puts( -1 );             return 0;           }           res[pos] = a[ans] - pos;         } else {           if (a[ans] % n != (res[pos] + pos) % n) {             puts( -1 );             return 0;           }         }         u[a[ans] - pos] = 1;       } else {         if (res[pos] == 0) {           if (u[a[ans] + n - pos]) {             puts( -1 );             return 0;           }           res[pos] = a[ans] + n - pos;         } else {           if (a[ans] % n != (res[pos] + pos) % n) {             puts( -1 );             return 0;           }         }         u[a[ans] + n - pos] = 1;       }       pos = a[ans++];     }     for (int i = 1; i <= n; i++) {       if (res[i] == 0) {         for (int j = 1; j <= n; j++) {           if (u[j] == 0) {             res[i] = j;             u[j] = 1;             break;           }         }       }       printf( %d  , res[i]);     }   }   