#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5;   int N, M, A[MAXN + 10], ans[MAXN + 10];   int main() {     int i, j;     scanf( %d%d , &N, &M);     long long sum = 0;     for (i = 1; i <= M; i++) scanf( %d , &A[i]), sum += A[i];     if (sum < N) return !printf( -1 );     int last = 987654321;     for (i = M; i >= 1; i--) {       int t = min(N - A[i] + 1, last - 1);       if (t <= 0) return !printf( -1 );       ans[i] = t;       last = t;     }     int start = 1;     for (i = 1; i <= M; i++) {       if (start >= ans[i]) break;       ans[i] = start;       start = A[i] + ans[i];     }     for (i = 1; i <= M; i++) printf( %d  , ans[i]);   }   