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

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

import javax.print.attribute.HashAttributeSet;

public class CodeForces {

  public void solve() throws IOException, NoSuchAlgorithmException {
    int k = nextInt();
    char[] str = nextToken().toCharArray();
    Arrays.sort(str);
    char[] res = new char[str.length];
    boolean can = true;
    if (str.length % k != 0) {
      can = false;
    } else {
      for (int i = 0, l = str.length; i < l; i+=k) {
        int temp = str[i];
        for (int j = 0; j < k; j++) {
          if(str[i+j]!=temp) {
            can = false;
          } else {
            res[i/k+l*j/k]=str[i+j];
          }
        }
      }
    }

    if (can) {
      StringBuffer sb = new StringBuffer();
      for (int i = 0, l = res.length; i < l; i++) {
        sb.append(res[i]);
      }
      out.print(sb.toString());
    } else {
      out.print(-1);
    }

  }

  private boolean test(String n) {
    if (n.charAt(0) != n.charAt(1) && n.charAt(0) != n.charAt(2) && n.charAt(0) != n.charAt(3) && n.charAt(1) != n.charAt(2)
        && n.charAt(1) != n.charAt(3) && n.charAt(2) != n.charAt(3)) {
      return false;
    }

    return true;
  }

  public static void main(String[] args) {
    new CodeForces().run();
  }

  long NOD(long a, long b) {
    while (a != 0 && b != 0) {
      if (a >= b)
        a = a % b;
      else
        b = b % a;
    }
    return a + b;
  }

  BufferedReader reader;
  StringTokenizer tokenizer;
  PrintWriter out;
  boolean isOuterFile = false;

  public void run() {
    try {
      if (isOuterFile) {
        reader = new BufferedReader(new FileReader("input.txt"));
        out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        out = new PrintWriter(System.out);
      } else {
        reader = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
      }

      tokenizer = null;
      // long t=new Date().getTime();
      solve();
      // writer.println(t-new Date().getTime());
      reader.close();
      out.close();
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  int nextInt() throws IOException {
    return Integer.parseInt(nextToken());
  }

  long nextLong() throws IOException {
    return Long.parseLong(nextToken());
  }

  double nextDouble() throws IOException {
    return Double.parseDouble(nextToken());
  }

  String nextToken() throws IOException {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine());
    }
    return tokenizer.nextToken();
  }
}