#include <bits/stdc++.h>
using namespace std;
int k, x, vis[30];
string s, ans;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> k >> s;
for(int i = 0; i < s.size(); i++)
vis[s[i] - 'a']++;
for(int i = 0; i < 26; i++)
if(vis[i] && vis[i] % k != 0)
return cout << -1, 0;
for(int i = 0; i < 26; i++)
if(vis[i])
x = vis[i] / k, ans += i + 'a';
while(k--)
cout << ans;
return 0;
}