#include<cstdio>
#include<algorithm>
using namespace std;
int a[100005],b[100005];
int main(){
int n,m,i;
long long sum=0;
scanf("%d%d",&n,&m);
b[m+1]=2147483647;
for(i=1;i<=m;i++){
scanf("%d",&a[i]);
sum+=a[i];
if(a[i]+i>n+1){
printf("-1");
return 0;
}
}
if(sum<n){
printf("-1");
return 0;
}
for(i=m;i;i--){
b[i]=min(n-a[i]+1,b[i+1]-1);
}
b[1]=1;
for(i=2;i<=m;i++){
if(b[i-1]+a[i-1]>=b[i]){
break;
}
b[i]=b[i-1]+a[i-1];
}
for(i=1;i<=m;i++){
printf("%d ",b[i]);
}
return 0;
}
574A - Bear and Elections | 352B - Jeff and Periods |
1244A - Pens and Pencils | 1670A - Prof Slim |
1189A - Keanu Reeves | 678A - Johny Likes Numbers |
1699C - The Third Problem | 1697D - Guess The String |
754B - Ilya and tic-tac-toe game | 760A - Petr and a calendar |
1573A - Countdown | 166A - Rank List |
1631B - Fun with Even Subarrays | 727A - Transformation from A to B |
822B - Crossword solving | 1623A - Robot Cleaner |
884B - Japanese Crosswords Strike Back | 862B - Mahmoud and Ehab and the bipartiteness |
429A - Xor-tree | 1675C - Detective Task |
950A - Left-handers Right-handers and Ambidexters | 672B - Different is Good |
1C - Ancient Berland Circus | 721A - One-dimensional Japanese Crossword |
1715B - Beautiful Array | 60B - Serial Time |
453A - Little Pony and Expected Maximum | 1715A - Crossmarket |
1715C - Monoblock | 1512C - A-B Palindrome |