Problem: Piegirl is buying stickers for a project. Stickers come on sheets, and each sheet of stickers contains exactly n stickers. Each sticker has exactly one character printed on it, so a sheet of stickers can be described by a string of length n. Piegirl wants to create a string s using stickers. She may buy as many sheets of stickers as she wants, and may specify any string of length n for the sheets, but all the sheets must be identical, so the string is the same for all sheets. Once she attains the sheets of stickers, she will take some of the stickers from the sheets and arrange (in any order) them to form s. Determine the minimum number of sheets she has to buy, and provide a string describing a possible sheet of stickers she should buy.

Input

The first line contains string s (1 ≤ |s| ≤ 1000), consisting of lowercase English characters only. The second line contains an integer n (1 ≤ n ≤ 1000).

Output

On the first line, print the minimum number of sheets Piegirl has to buy. On the second line, print a string consisting of n lower case English characters. This string should describe a sheet of stickers that Piegirl can buy in order to minimize the number of sheets. If Piegirl cannot possibly form the string s, print instead a single line with the number -1.

Examples

Input

banana
4


Output

2
baan


Input

banana
3


Output

3
nab


Input

banana
2


Output

-1

Note

In the second example, Piegirl can order 3 sheets of stickers with the characters "nab". She can take characters "nab" from the first sheet, "na" from the second, and "a" from the third, and arrange them to from "banana".

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long countBits(long long n) {
  long long cnt = 0;
  while (n) {
    cnt++;
    n >>= 1;
  }
  return cnt;
}
long long power(long long a, long long n, long long d) {
  long long res = 1;
  while (n) {
    if (n & 1 != 0) {
      res = ((res % d) * ((a % d + d) % d)) % d;
      n--;
    } else {
      a = ((((a % d + d) % d)) * (((a % d + d) % d))) % d;
      n >>= 1;
    }
  }
  return res;
}
void SieveOfEratosthenes(long long N, vector<long long>& s) {
  s[0] = 0;
  s[1] = 0;
  s[2] = 1;
  s[3] = 1;
  bool prime[N + 1];
  memset(prime, true, sizeof(prime));
  for (long long p = 2; p * p <= N; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= N; i += p) {
        prime[i] = false;
        s[i] = 0;
      }
    }
  }
}
struct not_digit {
  bool operator()(const char c) { return c != ' ' && !std::isdigit(c); }
};
void extractNum(string str, vector<long long>& numbers) {
  not_digit not_a_digit;
  string::iterator end = std::remove_if(str.begin(), str.end(), not_a_digit);
  string all_numbers(str.begin(), end);
  stringstream second(all_numbers);
  for (long long i = 0; second >> i;) {
    numbers.push_back(i);
  }
}
void getWords(string str, vector<string>& vec, unordered_set<string>& Set) {
  string word;
  stringstream iss(str);
  while (iss >> word) {
    Set.insert(word);
    vec.push_back(word);
  }
}
bool isPower(long long n) {
  if (n <= 1) return true;
  for (long long x = 2; x <= sqrt(n); x++) {
    unsigned p = x;
    while (p <= n) {
      p *= x;
      if (p == n) return true;
    }
  }
  return false;
}
string decimalToBinary(long long n) {
  string s = bitset<64>(n).to_string();
  const auto loc1 = s.find('1');
  if (loc1 != string::npos) return s.substr(loc1);
  return "0";
}
double slope(long long x1, long long y1, long long x2, long long y2) {
  double angle;
  angle = (y2 - y1) / (double)(x2 - x1);
  return angle;
}
bool isPrime(long long n) {
  if (n == 1)
    return false;
  else {
    for (long long i = 2; i * i <= n; i++) {
      if (n % i == 0) return false;
    }
    return true;
  }
}
long long Power(long long a, long long n) {
  long long res = 1;
  if (n == 0) return 1;
  while (n) {
    if (n & 1 != 0) {
      res *= a;
      n--;
    } else {
      a *= a;
      n >>= 1;
    }
  }
  return res;
}
long long Mod(long long x) {
  return ((x % 1000000007 + 1000000007) % 1000000007);
}
long long add(long long a, long long b) { return Mod(Mod(a) + Mod(b)); }
long long mul(long long a, long long b) { return Mod(Mod(a) * Mod(b)); }
const long long N = 2e5 + 2;
long long fact[N];
void precalc() {
  fact[0] = 1;
  for (long long i = 1; i < N; i++) {
    fact[i] = mul(fact[i - 1], i);
  }
}
long long inv(long long x) { return pow(x, 1000000007 - 2); }
long long divide(long long a, long long b) { return mul(a, inv(b)); }
long long nCr(long long n, long long r) {
  return divide(fact[n], mul(fact[r], fact[n - r]));
}
bool isPalindrome(string s) {
  long long i, len = s.size();
  for (i = 0; i < len / 2; i++) {
    if (s[i] != s[len - i - 1]) return 0;
  }
  return 1;
}
void primeFactors(long long n, vector<long long>& vec) {
  while (n % 2 == 0) {
    vec.push_back(2);
    n = n / 2;
  }
  for (long long i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      vec.push_back(i);
      n = n / i;
    }
  }
  if (n > 2) vec.push_back(n);
}
void solve() {
  long long i, n, q, value, j, copyN, temp;
  string s;
  cin >> s;
  cin >> n;
  copyN = n;
  map<char, long long> m;
  for (i = 0; i < s.size(); i++) {
    m[s[i]]++;
  }
  string ans = "";
  if (n >= s.size()) {
    for (i = 0; i < n; i++) {
      if (i < s.size())
        ans.push_back(s[i]);
      else
        ans.push_back('a');
    }
    cout << "1" << endl;
    cout << ans << endl;
    return;
  }
  if (m.size() > n) {
    cout << "-1" << endl;
    return;
  }
  temp = 0;
  ans.clear();
  for (i = 1; i <= s.size(); i++) {
    for (auto it = m.begin(); it != m.end(); it++) {
      temp += ceil((double)(it->second) / i);
    }
    if (temp <= copyN) break;
    temp = 0;
  }
  temp = i;
  cout << temp << endl;
  for (auto it = m.begin(); it != m.end(); it++) {
    long long value = ceil(((double)(it->second) / temp));
    for (i = 0; i < value; i++) ans.push_back(it->first);
  }
  if (ans.size() < n)
    ;
  {
    while (ans.size() < n) ans.push_back('a');
  }
  cout << ans << endl;
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}