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

/// You just can't beat the person who never gives up
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;

const int N = 2e5+5 ;

int t ,n ,k ;
char str[N] ;
int cnt[26] ;
bool done(){
    memset(cnt,0,sizeof cnt);
    for(int i=0;i<n;++i) ++cnt[str[i]-'a'] ;
    for(int i='a';i<='z';++i) if(cnt[i-'a']%k) return 0;
    return 1;
}
bool ok(int j){
    int rem = n-j-1 ;
    for(int i=str[j]+1;i<='z';++i){
        ++cnt[i-'a'] ;
        long long need = 0 ;
        for(int ch='a';ch<='z';++ch){
            int cur = (cnt[ch-'a'])%k ;
            if(cur==0) continue ;
            need += k-cur ;
        }
        --cnt[i-'a'] ;

        if(need>rem) continue ;
        if((rem-need)%k==0) return 1;
    }
    return 0;
}
char ret[N] ;
void build(int j){
    memset(cnt,0,sizeof cnt);
    int sz = 0 ;
    for(int i=0;i<j;++i){
        ret[sz++] = str[i] ;
        ++cnt[str[i]-'a'] ;
    }
    int rem = n-j-1 ;
    for(int i=str[j]+1;i<='z';++i){
        ++cnt[i-'a'] ;
        long long need = 0 ;
        for(int ch='a';ch<='z';++ch){
            int cur = cnt[ch-'a']%k ;
            if(cur==0) continue ;
            need += k-cur ;
        }
        --cnt[i-'a'] ;

        if(need>rem) continue ;
        if((rem-need)%k==0){
            ++cnt[i-'a'] ;
            ret[sz++] = i ;
            int as = rem-need ;
            while(as--) ret[sz++] = 'a' ;
            for(int ch='a';ch<='z';++ch){
                int cur = cnt[ch-'a']%k ;
                if(cur==0) continue ;

                int ne = k-cur ;
                while(ne--) ret[sz++] = ch ;
            }
            for(int j=0;j<n;++j) printf("%c",ret[j]);
            puts("");
            return ;
        }
    }
}
int main(){
    scanf("%d",&t);
    while(t--){
        scanf("%d%d%s",&n,&k,str);
        if(n%k){
            puts("-1");
            continue ;
        }
        if(done()){
            printf("%s\n",str);
            continue ;
        }
        memset(cnt,0,sizeof cnt);
        int best = -1 ;
        for(int i=0;i<n;++i){
            if(str[i]!='z' && ok(i)) best = i ;
            ++cnt[str[i]-'a'] ;
        }
        if(best==-1){
            puts("-1");
            continue ;
        }
        build(best);
    }
    return 0;
}
