#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long INF = (1LL << 45LL);
const long long MAXLL = 9223372036854775807LL;
const unsigned long long MAXULL = 18446744073709551615LLU;
const long long MOD = 1000000007;
const long double DELTA = 0.000000001L;
inline long long fmm(long long a, long long b, long long m = MOD) {
  long long r = 0;
  a %= m;
  b %= m;
  while (b > 0) {
    if (b & 1) {
      r += a;
      r %= m;
    }
    a += a;
    a %= m;
    b >>= 1;
  }
  return r % m;
}
inline long long fme(long long a, long long b, long long m = MOD) {
  long long r = 1;
  a %= m;
  while (b > 0) {
    if (b & 1) {
      r *= a;
      r %= m;
    }
    a *= a;
    a %= m;
    b >>= 1;
  }
  return r % m;
}
inline long long sfme(long long a, long long b, long long m = MOD) {
  long long r = 1;
  a %= m;
  while (b > 0) {
    if (b & 1) r = fmm(r, a, m);
    a = fmm(a, a, m);
    b >>= 1;
  }
  return r % m;
}
std::vector<long long> primes;
long long primsiz;
std::vector<long long> fact;
std::vector<long long> invfact;
inline void sieve(long long n) {
  long long i, j;
  std::vector<bool> a(n);
  a[0] = true;
  a[1] = true;
  for (i = 2; i * i < n; ++i) {
    if (!a[i]) {
      for (j = i * i; j < n; j += i) {
        a[j] = true;
      }
    }
  }
  for (i = 2; i < n; ++i)
    if (!a[i]) primes.push_back(i);
  primsiz = primes.size();
}
inline void sieve() {
  long long n = 1010000, i, j, k = 0;
  std::vector<bool> a(n);
  primes.resize(79252);
  a[0] = a[1] = true;
  for (i = 2; (j = (i << 1)) < n; ++i) a[j] = true;
  for (i = 3; i * i < n; i += 2) {
    if (!a[i]) {
      k = (i << 1);
      for (j = i * i; j < n; j += k) a[j] = true;
    }
  }
  k = 0;
  for (i = 2; i < n; ++i)
    if (!a[i]) primes[k++] = i;
  primsiz = k;
}
inline bool isPrimeSmall(unsigned long long n) {
  if (((!(n & 1)) && n != 2) || (n < 2) || (n % 3 == 0 && n != 3)) return false;
  for (unsigned long long k = 1; 36 * k * k - 12 * k < n; ++k)
    if ((n % (6 * k + 1) == 0) || (n % (6 * k - 1) == 0)) return false;
  return true;
}
bool _p(unsigned long long a, unsigned long long n) {
  unsigned long long t, u, i, p, c = 0;
  u = n / 2, t = 1;
  while (!(u & 1)) {
    u /= 2;
    ++t;
  }
  p = fme(a, u, n);
  for (i = 1; i <= t; ++i) {
    c = (p * p) % n;
    if ((c == 1) && (p != 1) && (p != n - 1)) return 1;
    p = c;
  }
  if (c != 1) return 1;
  return 0;
}
inline bool isPrime(unsigned long long n) {
  if (((!(n & 1)) && n != 2) || (n < 2) || (n % 3 == 0 && n != 3)) return 0;
  if (n < 1373653) {
    for (unsigned long long k = 1; (((36 * k * k) - (12 * k)) < n); ++k)
      if ((n % (6 * k + 1) == 0) || (n % (6 * k - 1) == 0)) return 0;
    return 1;
  }
  if (n < 9080191) {
    if (_p(31, n) || _p(73, n)) return 0;
    return 1;
  }
  if (_p(2, n) || _p(7, n) || _p(61, n)) return 0;
  return 1;
}
unsigned long long nCk(long long n, long long k, unsigned long long m = MOD) {
  if (k < 0 || k > n || n < 0) return 0;
  if (k == 0 || k == n) return 1;
  if (fact.size() >= (unsigned long long)n && isPrime(m)) {
    return (((fact[n] * invfact[k]) % m) * invfact[n - k]) % m;
  }
  unsigned long long i = 0, j = 0, a = 1;
  k = ((k) < (n - k) ? (k) : (n - k));
  for (; i < (unsigned long long)k; ++i) {
    a = (a * (n - i)) % m;
    while (j < (unsigned long long)k && (a % (j + 1) == 0)) {
      a = a / (j + 1);
      ++j;
    }
  }
  while (j < (unsigned long long)k) {
    a = a / (j + 1);
    ++j;
  }
  return a % m;
}
void nCkInit(unsigned long long m = MOD) {
  long long i, mx = 1010000;
  fact.resize(mx + 1);
  invfact.resize(mx + 1);
  fact[0] = 1;
  for (i = 1; i <= mx; ++i) {
    fact[i] = (i * fact[i - 1]) % m;
  }
  invfact[mx] = fme(fact[mx], m - 2, m);
  for (i = mx - 1; i >= 0; --i) {
    invfact[i] = (invfact[i + 1] * (i + 1)) % m;
  }
}
template <class T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void extGCD(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1, y = 0;
    return;
  }
  long long x1, y1;
  extGCD(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
}
inline void get(long long &x) {
  int n = 0;
  x = 0;
  char c = getchar_unlocked();
  if (c == '-') n = 1;
  while (c < '0' || c > '9') {
    c = getchar_unlocked();
    if (c == '-') n = 1;
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar_unlocked();
  }
  if (n) x = -x;
}
inline int get(char *p) {
  char c = getchar_unlocked();
  int i = 0;
  while (c != '\n' && c != '\0' && c != ' ' && c != '\r' && c != EOF) {
    p[i++] = c;
    c = getchar_unlocked();
  }
  p[i] = '\0';
  return i;
}
inline void put(long long a) {
  int n = (a < 0 ? 1 : 0);
  if (n) a = -a;
  char b[20];
  int i = 0;
  do {
    b[i++] = a % 10 + '0';
    a /= 10;
  } while (a);
  if (n) putchar_unlocked('-');
  i--;
  while (i >= 0) putchar_unlocked(b[i--]);
  putchar_unlocked(' ');
}
inline void putln(long long a) {
  int n = (a < 0 ? 1 : 0);
  if (n) a = -a;
  char b[20];
  int i = 0;
  do {
    b[i++] = a % 10 + '0';
    a /= 10;
  } while (a);
  if (n) putchar_unlocked('-');
  i--;
  while (i >= 0) putchar_unlocked(b[i--]);
  putchar_unlocked('\n');
}
const int K = 3;
std::vector<std::vector<long long> > mul(std::vector<std::vector<long long> > a,
                                         std::vector<std::vector<long long> > b,
                                         unsigned long long m = MOD) {
  std::vector<std::vector<long long> > c(K, std::vector<long long>(K));
  for (long long ii = 0; ii < (K); ++ii)
    for (long long jj = 0; jj < (K); ++jj)
      for (long long kk = 0; kk < (K); ++kk)
        c[ii][jj] = (c[ii][jj] + a[ii][kk] * b[kk][jj]) % m;
  return c;
}
std::vector<std::vector<long long> > fme(std::vector<std::vector<long long> > a,
                                         unsigned long long n,
                                         unsigned long long m = MOD) {
  if (n == 1) return a;
  if (n & 1) return mul(a, fme(a, n - 1, m), m);
  std::vector<std::vector<long long> > x = fme(a, n / 2, m);
  return mul(x, x, m);
}
long long l[1010], a[1010];
bool used[1010];
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  long long t = 0, n = 0, m = 0, maxx = 0, minn = 0, curr = 0, k = 0, num = 0,
            siz = 0, n1 = 0, n2 = 0, n3 = 0, n4 = 0, ind = 0;
  long long root = 0, sum = 0, diff = 0, q = 0, choice = 0, d = 0, len = 0,
            begg = 0, endd = 0, pos = 0, cnt = 0, lo = 0, hi = 0, mid = 0,
            ans = 0;
  bool flag = false;
  std::string s1, s2, s3, str;
  char ch, ch1, ch2, ch3, *ptr;
  double dub = 0;
  cin >> n >> m;
  for (long long i = 1; i <= (m); ++i) cin >> l[i];
  for (long long i = 1; i <= (m - 1); ++i) {
    curr = l[i];
    q = l[i + 1];
    if (q <= curr) q += n;
    d = (q - curr);
    if (used[d] || d < 1 || d > n) {
      if (a[l[i]] == d) continue;
      cout << -1;
      exit(0);
    }
    used[d] = true;
    a[l[i]] = d;
  }
  for (long long i = 1; i <= (n); ++i) {
    if (a[i] < 1 || a[i] > n) {
      for (long long j = 1; j <= (n); ++j) {
        if (!used[j]) {
          used[j] = true;
          a[i] = j;
          break;
        }
      }
      if (a[i] < 1 || a[i] > n) {
        cout << -1;
        exit(0);
      }
    }
  }
  for (long long i = 1; i <= (n); ++i) cout << a[i] << ' ';
  return 0;
}

### Prompt

Please formulate a CPP solution to the following problem:

n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it.

The game consists of m steps. On each step the current leader with index i counts out ai people in clockwise order, starting from the next person. The last one to be pointed at by the leader becomes the new leader.

You are given numbers l1, l2, ..., lm — indices of leaders in the beginning of each step. Child with number l1 is the first leader in the game. 

Write a program which will restore a possible permutation a1, a2, ..., an. If there are multiple solutions then print any of them. If there is no solution then print -1.

Input

The first line contains two integer numbers n, m (1 ≤ n, m ≤ 100).

The second line contains m integer numbers l1, l2, ..., lm (1 ≤ li ≤ n) — indices of leaders in the beginning of each step.

Output

Print such permutation of n numbers a1, a2, ..., an that leaders in the game will be exactly l1, l2, ..., lm if all the rules are followed. If there are multiple solutions print any of them. 

If there is no permutation which satisfies all described conditions print -1.

Examples

Input

4 5
2 3 1 4 4


Output

3 1 2 4 


Input

3 3
3 1 2


Output

-1

Note

Let's follow leadership in the first example: 

  * Child 2 starts. 
  * Leadership goes from 2 to 2 + a2 = 3. 
  * Leadership goes from 3 to 3 + a3 = 5. As it's greater than 4, it's going in a circle to 1. 
  * Leadership goes from 1 to 1 + a1 = 4. 
  * Leadership goes from 4 to 4 + a4 = 8. Thus in circle it still remains at 4. 

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long INF = (1LL << 45LL);
const long long MAXLL = 9223372036854775807LL;
const unsigned long long MAXULL = 18446744073709551615LLU;
const long long MOD = 1000000007;
const long double DELTA = 0.000000001L;
inline long long fmm(long long a, long long b, long long m = MOD) {
  long long r = 0;
  a %= m;
  b %= m;
  while (b > 0) {
    if (b & 1) {
      r += a;
      r %= m;
    }
    a += a;
    a %= m;
    b >>= 1;
  }
  return r % m;
}
inline long long fme(long long a, long long b, long long m = MOD) {
  long long r = 1;
  a %= m;
  while (b > 0) {
    if (b & 1) {
      r *= a;
      r %= m;
    }
    a *= a;
    a %= m;
    b >>= 1;
  }
  return r % m;
}
inline long long sfme(long long a, long long b, long long m = MOD) {
  long long r = 1;
  a %= m;
  while (b > 0) {
    if (b & 1) r = fmm(r, a, m);
    a = fmm(a, a, m);
    b >>= 1;
  }
  return r % m;
}
std::vector<long long> primes;
long long primsiz;
std::vector<long long> fact;
std::vector<long long> invfact;
inline void sieve(long long n) {
  long long i, j;
  std::vector<bool> a(n);
  a[0] = true;
  a[1] = true;
  for (i = 2; i * i < n; ++i) {
    if (!a[i]) {
      for (j = i * i; j < n; j += i) {
        a[j] = true;
      }
    }
  }
  for (i = 2; i < n; ++i)
    if (!a[i]) primes.push_back(i);
  primsiz = primes.size();
}
inline void sieve() {
  long long n = 1010000, i, j, k = 0;
  std::vector<bool> a(n);
  primes.resize(79252);
  a[0] = a[1] = true;
  for (i = 2; (j = (i << 1)) < n; ++i) a[j] = true;
  for (i = 3; i * i < n; i += 2) {
    if (!a[i]) {
      k = (i << 1);
      for (j = i * i; j < n; j += k) a[j] = true;
    }
  }
  k = 0;
  for (i = 2; i < n; ++i)
    if (!a[i]) primes[k++] = i;
  primsiz = k;
}
inline bool isPrimeSmall(unsigned long long n) {
  if (((!(n & 1)) && n != 2) || (n < 2) || (n % 3 == 0 && n != 3)) return false;
  for (unsigned long long k = 1; 36 * k * k - 12 * k < n; ++k)
    if ((n % (6 * k + 1) == 0) || (n % (6 * k - 1) == 0)) return false;
  return true;
}
bool _p(unsigned long long a, unsigned long long n) {
  unsigned long long t, u, i, p, c = 0;
  u = n / 2, t = 1;
  while (!(u & 1)) {
    u /= 2;
    ++t;
  }
  p = fme(a, u, n);
  for (i = 1; i <= t; ++i) {
    c = (p * p) % n;
    if ((c == 1) && (p != 1) && (p != n - 1)) return 1;
    p = c;
  }
  if (c != 1) return 1;
  return 0;
}
inline bool isPrime(unsigned long long n) {
  if (((!(n & 1)) && n != 2) || (n < 2) || (n % 3 == 0 && n != 3)) return 0;
  if (n < 1373653) {
    for (unsigned long long k = 1; (((36 * k * k) - (12 * k)) < n); ++k)
      if ((n % (6 * k + 1) == 0) || (n % (6 * k - 1) == 0)) return 0;
    return 1;
  }
  if (n < 9080191) {
    if (_p(31, n) || _p(73, n)) return 0;
    return 1;
  }
  if (_p(2, n) || _p(7, n) || _p(61, n)) return 0;
  return 1;
}
unsigned long long nCk(long long n, long long k, unsigned long long m = MOD) {
  if (k < 0 || k > n || n < 0) return 0;
  if (k == 0 || k == n) return 1;
  if (fact.size() >= (unsigned long long)n && isPrime(m)) {
    return (((fact[n] * invfact[k]) % m) * invfact[n - k]) % m;
  }
  unsigned long long i = 0, j = 0, a = 1;
  k = ((k) < (n - k) ? (k) : (n - k));
  for (; i < (unsigned long long)k; ++i) {
    a = (a * (n - i)) % m;
    while (j < (unsigned long long)k && (a % (j + 1) == 0)) {
      a = a / (j + 1);
      ++j;
    }
  }
  while (j < (unsigned long long)k) {
    a = a / (j + 1);
    ++j;
  }
  return a % m;
}
void nCkInit(unsigned long long m = MOD) {
  long long i, mx = 1010000;
  fact.resize(mx + 1);
  invfact.resize(mx + 1);
  fact[0] = 1;
  for (i = 1; i <= mx; ++i) {
    fact[i] = (i * fact[i - 1]) % m;
  }
  invfact[mx] = fme(fact[mx], m - 2, m);
  for (i = mx - 1; i >= 0; --i) {
    invfact[i] = (invfact[i + 1] * (i + 1)) % m;
  }
}
template <class T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void extGCD(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1, y = 0;
    return;
  }
  long long x1, y1;
  extGCD(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
}
inline void get(long long &x) {
  int n = 0;
  x = 0;
  char c = getchar_unlocked();
  if (c == '-') n = 1;
  while (c < '0' || c > '9') {
    c = getchar_unlocked();
    if (c == '-') n = 1;
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar_unlocked();
  }
  if (n) x = -x;
}
inline int get(char *p) {
  char c = getchar_unlocked();
  int i = 0;
  while (c != '\n' && c != '\0' && c != ' ' && c != '\r' && c != EOF) {
    p[i++] = c;
    c = getchar_unlocked();
  }
  p[i] = '\0';
  return i;
}
inline void put(long long a) {
  int n = (a < 0 ? 1 : 0);
  if (n) a = -a;
  char b[20];
  int i = 0;
  do {
    b[i++] = a % 10 + '0';
    a /= 10;
  } while (a);
  if (n) putchar_unlocked('-');
  i--;
  while (i >= 0) putchar_unlocked(b[i--]);
  putchar_unlocked(' ');
}
inline void putln(long long a) {
  int n = (a < 0 ? 1 : 0);
  if (n) a = -a;
  char b[20];
  int i = 0;
  do {
    b[i++] = a % 10 + '0';
    a /= 10;
  } while (a);
  if (n) putchar_unlocked('-');
  i--;
  while (i >= 0) putchar_unlocked(b[i--]);
  putchar_unlocked('\n');
}
const int K = 3;
std::vector<std::vector<long long> > mul(std::vector<std::vector<long long> > a,
                                         std::vector<std::vector<long long> > b,
                                         unsigned long long m = MOD) {
  std::vector<std::vector<long long> > c(K, std::vector<long long>(K));
  for (long long ii = 0; ii < (K); ++ii)
    for (long long jj = 0; jj < (K); ++jj)
      for (long long kk = 0; kk < (K); ++kk)
        c[ii][jj] = (c[ii][jj] + a[ii][kk] * b[kk][jj]) % m;
  return c;
}
std::vector<std::vector<long long> > fme(std::vector<std::vector<long long> > a,
                                         unsigned long long n,
                                         unsigned long long m = MOD) {
  if (n == 1) return a;
  if (n & 1) return mul(a, fme(a, n - 1, m), m);
  std::vector<std::vector<long long> > x = fme(a, n / 2, m);
  return mul(x, x, m);
}
long long l[1010], a[1010];
bool used[1010];
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  long long t = 0, n = 0, m = 0, maxx = 0, minn = 0, curr = 0, k = 0, num = 0,
            siz = 0, n1 = 0, n2 = 0, n3 = 0, n4 = 0, ind = 0;
  long long root = 0, sum = 0, diff = 0, q = 0, choice = 0, d = 0, len = 0,
            begg = 0, endd = 0, pos = 0, cnt = 0, lo = 0, hi = 0, mid = 0,
            ans = 0;
  bool flag = false;
  std::string s1, s2, s3, str;
  char ch, ch1, ch2, ch3, *ptr;
  double dub = 0;
  cin >> n >> m;
  for (long long i = 1; i <= (m); ++i) cin >> l[i];
  for (long long i = 1; i <= (m - 1); ++i) {
    curr = l[i];
    q = l[i + 1];
    if (q <= curr) q += n;
    d = (q - curr);
    if (used[d] || d < 1 || d > n) {
      if (a[l[i]] == d) continue;
      cout << -1;
      exit(0);
    }
    used[d] = true;
    a[l[i]] = d;
  }
  for (long long i = 1; i <= (n); ++i) {
    if (a[i] < 1 || a[i] > n) {
      for (long long j = 1; j <= (n); ++j) {
        if (!used[j]) {
          used[j] = true;
          a[i] = j;
          break;
        }
      }
      if (a[i] < 1 || a[i] > n) {
        cout << -1;
        exit(0);
      }
    }
  }
  for (long long i = 1; i <= (n); ++i) cout << a[i] << ' ';
  return 0;
}

```