12
12 3
zazasqzqsasq
1 1
z
1 1
a
15 4
abccbaabccbazaa
16 8
cadjfdsljfdkljds
6 2
baazaa
6 3
bosszb
6 1
qwerty
7 7
daaaaaa
14 2
acabcbdeffewzd
18 6
zzzzzzzzzzzzyyyyyz
9 4
aabaabbbc

zazasqzqsasq
z
a
-1
cbbbbbbbbccccccc
baazbz
bpbbpp
qwerty
ddddddd
acabcbdeffexdx
zzzzzzzzzzzzzzzzzz
-1

/*
 * by: Erik Morbach
 * Brazil
 */


#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> ii;
typedef pair<ii,int> pii;
typedef pair<int,ii> ipi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<string> vs;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repp(i,a,n,p) for(int i=a;i<n;i+=p)
#define per(i,a,n) for(int i=a;i>=n;i--)

int red(int &x){ return scanf("%d",&x); }
int red(int &x,int &y){ return scanf("%d %d",&x,&y); }
int red(int &x,int &y,int &z){ return scanf("%d %d %d",&x,&y,&z); }

int red(ll &x) { return scanf("%lld",&x); }
int red(ll &x,ll &y) { return scanf("%lld %lld",&x,&y); }
int red(ll &x,ll &y,ll &z) { return scanf("%lld %lld %lld",&x,&y,&z); }

#define LINF 1<<60
#define INF 1<<30
#define x first
#define y second
#define lsb(idx) idx&(-idx)
#define pb push_back
#define pq priority_queue
#define EPS 1e-10
#define PI 2*acos(0)

#define MOD 1000000007

int cnt['z'+10];
int n,k;



int main(){

	auto falta = [&](char x){
		return (k-cnt[x]%k)%k;	
	};


	int t; red(t);
	rep(caso,0,t){
		memset(cnt,0,sizeof(cnt));
		red(n,k);
		char* s = new char[n+10];
		scanf(" %s",s);

		if(n%k) {
			printf("-1\n");
			continue;
		}

		rep(i,0,n) cnt[s[i]]++;


		int soma = 0;
		rep(i,'a','z'+1) soma+=falta(i);

		if(soma==0) {
			printf("%s\n",s);
			continue;
		}


		per(i,n-1,0){
			soma -= falta(s[i]);
			cnt[s[i]]--;
			soma += falta(s[i]);
			
			bool eh = false;
			rep(alpha, s[i]+1, 'z'+1){
				soma -= falta(alpha);
				cnt[alpha]++;
				soma += falta(alpha);

				if(n-(i+1)>=soma){
					s[i] = alpha;	
					rep(o,0,i+1) printf("%c",s[o]);

					vector<char> suf;
					rep(newe,'a','z'+1){
						int aux = falta(newe);
						while(aux--) suf.pb(newe);
					}
					int auxiliarSize = suf.size(); 

					vector<char> test;
					rep(o,i+1,n){
						if(suf.empty()){
							test.pb('a');
							continue;
						}
						test.pb(suf[suf.size()-1]);
						suf.pop_back();
					}
					sort(test.begin(),test.end());
					rep(o,0,test.size()) printf("%c",test[o]);
					printf("\n");
					

					eh = true;
					break;
				}
				soma -= falta(alpha);
				cnt[alpha]--;
				soma += falta(alpha);
			}

			if(eh) break;
		}
	}
}











