// Author: Lukas Polacek
// Date: October 18th, 2010
// Algorithm: Greedy
// Complexity: O(N^2 log N)

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <stack>
#include <cstdio>
#include <cassert>
using namespace std;

#define rep(i,a,b) for(__typeof(b) i=a; i<(b); ++i)

typedef pair<int, int> pii;
typedef vector<int> vi;
int main()
{
    int t; scanf("%d", &t);
    while (t--)
    {
        int p, n;
        scanf("%d %d", &p, &n);

        vi a(n), b(n);
        rep(i,0,n)
            scanf("%d", &a[i]);

        vector<bool> used(n, false);
        b = a;
        rep(i,0,n)
        {
            int ind = -1;
            rep(j,0,n) if (!used[j] && (ind == -1 || a[j] < a[ind]))
                ind = j;

            int subtr = a[ind];
            if (a[ind] * (n - i) < p)
            {
                p -= subtr * (n - i);
                rep(j,0,n) if (!used[j])
                    a[j] -= subtr;
            }
            else
            {
                int poc = p % (n - i);
                subtr = p / (n - i);
                vector<pii> x;
                rep(j,0,n) if (!used[j])
                    x.push_back(pii(-a[j], j));
                sort(x.begin(), x.end());
                rep(j,0,x.size())
                    a[x[j].second] -= subtr + (j < poc);
                p = 0;
            }
            used[ind] = true;
        }

        if (p > 0)
            printf("IMPOSSIBLE\n");
        else
        {
            rep(i,0,n)
            {
                printf("%d", b[i] - a[i]);
                if (i + 1 < n)
                    printf(" ");
            }
            printf("\n");
        }
    }
}
