2
aaab
 2
babac
 2
aaaaaabbbb
 1
aabaab
 2
aabbbbccccccdddddddd
 2
abba
 2
aaaazzzz
 250
cececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececece
 3
aaaaaaaaacccdddddd
 2
aabaab
 1
aaaaa
 7
abacaba
 2
aaaabbbb
 5
aaaaa
 1
aaa
 2
aaazz
 3
aabaaaaabb
 2
aaaa
 2
aa
 3
bbbccc
 15
abaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaa
 1
a
 2
bbaaaa
 2
aaaabb
 2
aabbbb
 2
aaaaaazz
 3
aaaaaaaaacccbbbbbb
 2
bbbbaa
 2
aaaazz
 2
aazzzz
 2
acaccc

-1
 -1
 aaabbaaabb aaaabb
 abbcccddddabbcccdddd abab
 aazzaazz cececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececece
 aaacddaaacddaaacdd aabaab
 aaaaa
 -1
 aabbaabb
 aaaaa
 aaa
 -1
 -1
 aaaa
 aa
 bcbcbc
 aaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbc a
 aabaab
 aabaab
 abbabb
 aaazaaaz aaabbcaaabbcaaabbc
 abbabb
 aazaaz azzazz
 accacc

/*==============================================
Name        : Shadman Shariar                 ||
Email       : shadman.shariar@northsouth.edu  ||
University  : North South University (NSU)    ||
Facebook    : shadman.shahriar.007            ||
==============================================*/
import java.util.*;
import java.io.*;
//import java.math.BigInteger;
//import java.text.DecimalFormat;
 
public class Main {
 
public static Main obj = new Main();
public static Scanner input = new Scanner (System.in);
//public static DecimalFormat df = new DecimalFormat(".000");
//public static BufferedReader br = new BufferedReader
//(new InputStreamReader(System.in));
public static void main(String[] args) throws Exception {
//FastReader fr = new FastReader();
Scanner input = new Scanner (System.in);
//PrintWriter pw = new PrintWriter(System.out);
//BigInteger bi1 = new BigInteger("0");
//StringBuilder sb = new StringBuilder();
 
//-----------------CODE STARTS FROM HERE------------------//


//int tt = input.nextInt();
//
//for (int i = 0; i < tt; i++) {
	
	int a = Math.abs(input.nextInt());
	
	int [] arr = new int[26];
	
	Arrays.fill(arr,0);
	
	String s = input.next();
	
	for (int i = 0; i <s.length(); i++) {
		
		arr[(int)(s.charAt(i)-97)]++;
		
	}
		
	boolean bo = true;
	
	for (int i = 0; i < arr.length; i++) {
		
		if(arr[i]>0&&arr[i]%a!=0) {
			bo = false;
			break;
		}
		
	}
		
	
	if(bo) {		
			char [] brr = s.toCharArray();
			
			Arrays.sort(brr);
			
			for (int j = 0; j < brr.length; j++) {
				System.out.print(brr[j]);
			}
	}
	else {
		System.out.println(-1);
	}
	
	
//}


//---------------------CODE ENDS HERE---------------------//
 
        //pw.close();
        input.close();
		System.exit(0);
}
 
public static long nCr(long n, long r)
{
    return factorial(n) / (factorial(r) *
                  factorial(n - r));
}

public static long nPr(long n, long r)
{
    return factorial(n) / factorial(n - r);
}

public static int countsubstring(String str)
{
    int n = str.length();
    return n * (n + 1) / 2;
}
 
public static boolean ispalindrome(String str)
{
    int i = 0, j = str.length() - 1;
    while (i < j) {
        if (str.charAt(i) != str.charAt(j))
            return false;
        i++;
        j--;
    }
    return true;
}
 
public static boolean perfectsquare(long x)
{
    if (x >= 0) {
        long sr = (long)(Math.sqrt(x));
        return ((sr * sr) == x);
    }
    return false;
}
 
public static boolean perfectcube(long N)
{
    int cube; int c = 0;
    for (int i = 0; i <= N; i++) {
        cube = i * i * i;
        if (cube == N) {
           
            c=1; break;
        }
        else if (cube > N) {
          
           c=0 ; break ;
        }
    }
	if (c==1)return true;
	else return false;
}
 
public static boolean[] sieveOfEratosthenes(int n)
{
    boolean prime[] = new boolean[n + 1];
    for (int i = 0; i <= n; i++)
        prime[i] = true;
 
    for (int p = 2; p * p <= n; p++)
    {
        if (prime[p] == true)
        {
            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
    prime[1]=false;
    return prime;
}
	
	public static int removeduplicateelements(int arr[], int n){ 
		Arrays.sort(arr);
        if (n==0 || n==1){  
            return n;  
        }  
        int[] temp = new int[n];  
        int j = 0;  
        for (int i=0; i<n-1; i++){  
            if (arr[i] != arr[i+1]){  
                temp[j++] = arr[i];  
            }  
         }  
        temp[j++] = arr[n-1];      
        for (int i=0; i<j; i++){  
            arr[i] = temp[i];  
        }  
        return j;  
    }  
	
	public static int fibon(int n) {
 
		if (n <= 1) {
 
			return n;
		}
		int[] array = new int[n + 1];
		array[0] = 0;
		array[1] = 1;
		for (int i = 2; i <= n; i++) {
			array[i] = array[i - 2] + array[i - 1];
		}
 
		return array[n];
 
	}
 
	public static long sumofdigits(long n) {
		long sum = 0;
 
		while (n != 0) {
			sum = sum + n % 10;
			n = n / 10;
		}
 
		return sum;
	}
 
	public static int reversedigits(int num) {
		int rev_num = 0;
		while (num > 0) {
			rev_num = rev_num * 10 + num % 10;
			num = num / 10;
		}
		return rev_num;
	}
 
	public static int binarysearch(int arr[], int l, int r, int x) {
 
		if (r >= l) {
			int mid = l + (r - l) / 2;
			if (arr[mid] == x)
				return mid;
			if (arr[mid] > x)
				return binarysearch(arr, l, mid - 1, x);
			return binarysearch(arr, mid + 1, r, x);
		}
		return -1;
	}
 
	public static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}
 
	public static long lcm(long a, long b) {
		return (a / gcd(a, b)) * b;
	}
 
	public static void rangeofprimenumber(int a, int b) {
		int i, j, flag;
		for (i = a; i <= b; i++) {
			if (i == 1 || i == 0)
				continue;
			flag = 1;
			for (j = 2; j <= i / 2; ++j) {
				if (i % j == 0) {
					flag = 0;
					break;
				}
			}
			if (flag == 1)
				System.out.println(i);
		}
	}
 
	public static boolean isprime(long n) {
		if (n <= 1)
			return false;
		else if (n == 2)
			return true;
		else if (n % 2 == 0)
			return false;
		for (long i = 3; i <= Math.sqrt(n); i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
 
	public static long factorial(long n) {
		return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
	}
 
	public static int[] reversearrayinrange(int arr[], int start, int end) {
		int temp;
 
		while (start < end) {
			temp = arr[start];
			arr[start] = arr[end];
			arr[end] = temp;
			start++;
			end--;
		}
		return arr;
	}
 
    public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}