#include <bits/stdc++.h>
using namespace std;
int main() {
  clock_t tStart = clock();
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1, -1);
  vector<bool> used(n + 2, false);
  int oldL, l;
  cin >> oldL;
  bool ok = true;
  for (int i = 1; i < m; i++) {
    cin >> l;
    int v = l - oldL;
    if (v <= 0) v += n;
    if (a[oldL] == -1 && used[v]) ok = false;
    if (a[oldL] != -1 && a[oldL] != v) ok = false;
    a[oldL] = v;
    used[v] = true;
    oldL = l;
  }
  if (!ok) {
    cout << -1;
  } else {
    int usedIndex = 1;
    while (used[usedIndex]) usedIndex++;
    for (int i = 1; i <= n; i++) {
      if (a[i] == -1) {
        a[i] = usedIndex;
        usedIndex++;
        while (used[usedIndex]) usedIndex++;
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << a[i] << " ";
    }
  }
  return 0;
}
