//编译器级优化
// #pragma GCC optimize("O2")
// #include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <time.h>
#include <cstring>
#include <cmath>
#include <set>
#include <unordered_map>
#include <algorithm>
#include <cstdio>
#include <cassert>
#include <bitset>
// #include <bits/extc++.h>
//外部包含文件
// #include "D:/program_learning/vs_code/workplace/ACMtemplate/data_structure/SparseTable.hpp"
// #include "D:/program_learning/vs_code/workplace/ACMtemplate/computational_geometry/Convex.hpp"
//类型别名
using namespace std;
// using B_ll = __int128_t;
// using B_ull = __uint128_t;
using f32 = float;
using f64 = double;
using ll = long long;
//排序用
#define htl(v, n) (v),(v)+(n), greater<decltype((v)[1])>()
#define lth(v, n) (v),(v)+(n), less<decltype((v)[1])>()
//宏函数
#define Mt(args...) make_tuple(args)
#define Mp(a, b) make_pair((a), (b))
#define Gt(a, b) std::get<(b)>((a))
#define Add(a, b) accumulate((a), (b), 0)
#define Abs(a) (((a) > 0) ? (a) : -(a))
#define Max(a, b) (((a) > (b)) ? (a) : (b))
#define Min(a, b) (((a) < (b)) ? (a) : (b))
#define Ceil(a, b) (((a) + (b) - 1) / (b))
#define Floor(a, b) ((a) / (b))
#define Pow2(x) ((x) * (x))
#define Pow3(x) ((x) * (x) * (x))
//浮点数关系运算
#define isZero(x) ((x)>0?(x):-(x)<eps)
#define equal(x, y) (abs((x)-(y))<eps)
#define lthan(x, y) ((y)-(x)>eps)
#define bthan(x, y) ((x)-(y)>eps)
//简化循环
#define FOR(i, a, b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rFOR(i, a, b) for(ll i = (ll)(a); i >= (ll)(b); i--)
#define gFOR(i, a) for(ll i = h[(a)] ; ~i ; i = ne[i])
#define bFOR(i, a, b) for(ll i = (a); i <= (b); i <<= 1)
#define jFOR(i, a, b, step) for(ll i = (a); i <= (b); i += (step))
#define iFOR(it, begin, end) for(auto it = (begin); it!=(end);it++)
#define aFOR(a, s) for(auto (a) : (s))
//debug用
#define _var(x) cout << #x << " = " << (x) << endl
#define _arr1(a) for(ll i = 0 ; i < (a).size() ; i ++) cout << (a)[i] << ((i == (a).size() - 1) ? endl : space)
#define _arr2(a) for(auto s : (a) )for(ll j = 0 ; j < s.size() ; j ++) cout << s[j] << ((j == s.size() - 1) ? endl : space)
#define checktime() cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" ; system("pause")
//加快io
#define endl "\n"
#define __faster_io__ std::ios::sync_with_stdio(false),std::cin.tie(0),std::cout.tie(0);
//操作输出
#define space " "
#define setd(n) fixed << setprecision(n)
//初始化设置
#define case(t,i) ll t;cin >> t;for(ll i=1;i<=t;i++)
#define _set(b, c) memset((b), (c), sizeof(b))
//模板函数
template<typename T>
int read(T& result) { // fast read
char ch;int w = 1;
result = 0;
ch = getchar();
while(ch != '-' && !(ch >= '0' && ch <= '9'))
ch = getchar();
if(ch == '-')
w = -1;
while(isdigit(ch)){
result = result * 10 + (ch - '0');
ch = getchar();
}
result *= w;
return 1;
}
template<typename T>
void write (T x) { // fast output
string tmp;string tail = (x < 0) ? "-" : "";
while(x){
tmp += x % 10 + '0';
x /= 10;
}
tmp += tail;
reverse(tmp.begin(), tmp.end());
cout << tmp;
}
template<typename T>
T qpow(T x, T n, const T& mod){
ll ans = 1;
while(n){
if(n & 1)
ans = ans % mod * x % mod;
x = x % mod * x % mod;
n >>= 1;
}
return ans;
}
template<typename T>
inline T lowbit(T& x){
return x&-x;
}
template<typename T>
T m_plus(T a, T b, const T& mod){
return (a % mod + b % mod) % mod;
}
template<typename T>
T m_minus(T a, T b, const T& mod){
return ((a % mod - b % mod) % mod + mod) % mod;
}
template<typename T>
T m_mult(T a, T b, const T& mod){
return a % mod * b % mod;
}
template<typename T>
T Mod(T x, T y)
{
return (x % y + y) % y;
}
//常数
constexpr f32 fINF32 = 1e30;
constexpr f64 fINF64 = 1e300;
constexpr int INF32 = 0x3f3f3f3f;
constexpr ll INF64 = 0x3f3f3f3f3f3f3f3f;
constexpr f32 _fINF32 = -1e30;
constexpr f64 _fINF64 = -1e300;
constexpr int _INF32 = 0xcfcfcfcf;
constexpr ll _INF64 = 0xcfcfcfcfcfcfcfcf;
constexpr f64 eps = 1e-6;
const f64 pi = acos(-1);
constexpr ll mod = 9 + 7;
constexpr ll Bit = 1 << 20;
constexpr ll N = 1e6 + 5;
/*定义全局变量*/
int b[N], a[N];
/*辅助函数*/
/*核心函数*/
void solve(){
int n, k;
_set(b, n);
cin >> n >> k;
FOR(i, 1, k){ // 根据读入记录已知的b数组数据
ll pos, x;
cin >> pos >> x;
b[pos] = x;
}
FOR(i, 1, n){
if(!b[i]) // 对于没有给出的数字,我们可以贪心的把当前这个数字入栈,即b[i] = b[i - 1] + 1
b[i] = b[i - 1] + 1 ;
else if(b[i] > b[i - 1] + 1){ // 如果当前位置递增序列的数目比上一个位置+1还要大则为不可能情况
cout << -1 << endl;
return ;
}
}
// 初始给定的b数组
// 1 2 1 2 3 4 2 3 4 5
// 根据上述算法构造出的a数组
// 9 10 1 6 7 8 2 3 4 5
// 可以发现b数组合法的时候一定会构成多段差值为1的等差数列
// 又因为题目并没有对答案字典序大小的要求,所以我们可以从后往前首先将更小的数入栈
// 这样在从后往前考虑的时候因为更小的数可以让前面位置更大的数出栈,
// 所以我们就可以不考虑前面的数字优先满足后面位置的b数组的要求而不会产生无法匹配数字的情况
// 而对于洛谷的P6198题,因为题目有输出字典序最小的答案的要求,所以这个算法便无法使用,因为是先使用
// 较小的数,所以最终答案的字典序一定比要求的最小字典序的答案要大
stack<int> st;int cnt = 0;
rFOR(i, n, 1) {
while(b[i] > st.size()) // 用一些更小的数优先满足当前位置的b数组要求
st.push(++cnt);
a[i] = st.top(); // 满足要求时栈顶的元素就是对应的a数组的元素
st.pop(); // 进入下一个位置前先把当前位置的元素弹出栈
}
FOR(i, 1, n) cout << a[i] << (i == n ? endl : space);
}
/*程序入口*/
int main()
{
#ifdef LOCAL
freopen("D:/program_learning/vs_code/workplace/ACMtemplate/DataIn.txt", "r", stdin);
freopen("D:/program_learning/vs_code/workplace/ACMtemplate/DataOut.txt", "w", stdout);
#endif
__faster_io__
// case(t, i){
solve();
// }
#ifdef LOCAL
cout.flush();
freopen("CON", "r", stdin);
freopen("CON", "w", stdout);
#endif
checktime();
return 0;
}