#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
using namespace std;

template <typename T>
inline void read(T&x){
    x=0; char temp=getchar(); bool f=false;
    while(!isdigit(temp)){if(temp=='-') f=true; temp=getchar();}
    while(isdigit(temp)){x=(x<<1)+(x<<3)+temp-'0'; temp=getchar();}
    if(f) x=-x;
}
template <typename T>
void print(T x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) print(x/10);
    putchar(x%10+'0');
}

const int MAXN = 1e5+5;

//basic
int n,k;
char str[MAXN];

//Solve
int cnt[27];

inline int Calc(int x){return (k-(x%k))%k;}

inline bool Solve(){
    memset(cnt,0,sizeof(cnt));
    for(register int i=1;i<=n;i++) cnt[str[i]-'a']++;
    int remain=0;
    for(register int i=0;i<26;i++) remain+=Calc(cnt[i]);
    if(remain==0){for(register int i=1;i<=n;i++) putchar(str[i]); puts(""); return true;}
    for(register int i=n;i>=1;i--){
        int c=str[i]-'a';
        remain=remain-Calc(cnt[c])+Calc(--cnt[c]);
        for(register int j=c+1;j<26;j++){
            int sum=remain-Calc(cnt[j])+Calc(++cnt[j]);
            if(sum<=n-i){
                for(register int l=1;l<i;l++) putchar(str[l]); putchar('a'+j);
                for(register int l=1;l<=(n-i)-sum;l++) putchar('a');
                for(register int l=0;l<26;l++){
                    int temp=Calc(cnt[l]);
                    while(temp) putchar('a'+l),temp--;
                }
                puts("");
                return true;
            }
            cnt[j]--;
        }
    }
    return false;
}

int main(){
    int T; read(T);
    while(T--){
        read(n),read(k),scanf("%s",str+1);
        if(n%k!=0){puts("-1"); continue;}
        if(!Solve()) puts("-1");
    }
    return 0;
}