#include <stdio.h>
#include <stdlib.h>

#define MIN(a,b) ((a) < (b) ? (a) : (b))

#define MAXN 100

struct person {
	int p, i;
} persons[MAXN];

int ret[MAXN];

int compare_person(const void *_a, const void *_b) {
	struct person *a = (struct person *)_a;
	struct person *b = (struct person *)_b;
	if(a->p != b->p)
		return a->p - b->p;
	return b->i - a->i;
}

void testcase() {
	int P, n, i, sum;
	scanf("%d\n", &P);
	scanf("%d\n", &n);
	sum = 0;
	for(i = 0; i < n; i++) {
		scanf("%d\n", &persons[i].p);
		persons[i].i = i;
		sum += persons[i].p;
	}
	if(sum < P) {
		printf("IMPOSSIBLE\n");
		return;
	}
	qsort(persons, n, sizeof(struct person), compare_person);
	for(i = 0; i < n; i++) {
		ret[persons[i].i] = MIN(persons[i].p, P / (n - i));
		P -= ret[persons[i].i];
	}
	for(i = 0; i < n; i++) {
		if(i) printf(" ");
		printf("%d", ret[i]);
	}
	printf("\n");
}

int main() {
	int t;
	scanf("%d\n", &t);
	while(t--) testcase();
	return 0;
}
