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 JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.function.*;

public class Main {
    final static String fileName = "";
    final static boolean useFiles = false;

    public static void main(String[] args) throws FileNotFoundException {
        InputStream inputStream;
        OutputStream outputStream;
        if (useFiles) {
            inputStream = new FileInputStream(fileName + ".in");
            outputStream = new FileOutputStream(fileName + ".out");
        } else {
            inputStream = System.in;
            outputStream = System.out;
        }
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task(in, out);
        Debug.out = out;
        solver.solve();
        out.close();
    }
}
class Task {
    public void solve() {
        String s = in.next();
        int[] sc = ArrayUtils.countingSort(s);
        int n = in.nextInt();
        for (int ans = 1; ans <= s.length(); ans++) {
            int sum = 0;
            for (int j = 0; j < 26; j++) {
                sum += MathUtils.ceilDiv(sc[j], ans);
            }
            if (sum <= n) {
                out.println(ans);

                String result = "";
                for (char c = 'a'; c <= 'z'; c++) {
                    for (int j = 0; j < MathUtils.ceilDiv(sc[c - 'a'], ans); j++)
                        result += c;
                }
                int cnt = n - result.length();
                for (int i = 0; i < cnt; i++)
                    result += 'a';
                out.print(result);

                return;
            }
        }
        out.print(-1);
    }

    private InputReader in;
    private PrintWriter out;

    Task(InputReader in, PrintWriter out) {
        this.in = in;
        this.out = out;
    }
}

class Debug {
    public static PrintWriter out;

    public static void printObjects(Object... objects) {
        out.println(Arrays.deepToString(objects));
        out.flush();
    }
}


class ArrayUtils {
    static int[] countingSort(String s) {
        int[] count = new int[26];
        for (int i = 0; i < s.length(); i++) {
            count[s.charAt(i) - 'a']++;
        }
        return count;
    }

    static int[] scaling(int[] a) {
        int[] types = unique(a);
        int[] result = new int[a.length];
        for (int i = 0; i < a.length; i++)
            result[i] = Arrays.binarySearch(types, a[i]);
        return result;
    }

    static int[] filter(int[] array, Predicate<Integer> predicate) {
        int count = 0;
        for (int anArray : array) {
            if (predicate.test(anArray))
                count++;
        }
        int[] result = new int[count];
        int top = 0;
        for (int anArray : array) {
            if (predicate.test(anArray))
                result[top++] = anArray;
        }
        return result;
    }

    static int[] merge(int[] a, int[] b) {
        int[] result = new int[a.length + b.length];
        int i = 0, j = 0, k = 0;
        for (; i < a.length && j < b.length; k++) {
            if (a[i] < b[i])
                result[k] = a[i++];
            else
                result[k] = b[j++];
        }
        for (; i < a.length; i++)
            result[k++] = a[i];
        for (; j < b.length; j++)
            result[k++] = a[j];
        return result;
    }

    static int[] reverse(int[] a) {
        int[] result = new int[a.length];
        for (int i = 0; i < a.length; i++)
            result[i] = a[a.length - i - 1];
        return result;
    }

    static int[] unique(int[] a) {
        a = a.clone();
        Arrays.sort(a);
        int n = a.length;
        int count = 1;
        for (int i = 1; i < n; i++) {
            if (a[i] != a[i - 1])
                count++;
        }
        int[] result = new int[count];
        result[0] = a[0];
        for (int i = 1, j = 1; i < n; i++) {
            if (a[i] != a[i - 1])
                result[j++] = a[i];
        }
        return result;
    }
}

class Combinatorics {
    private int[] f;
    private int size;
    private int mod;

    Combinatorics(int n, int mod) {
        f = new int[n];
        f[0] = 1;
        for (int i = 1; i <= n; i++)
            f[i] = (int) ((f[i - 1] * ((long) i)) % mod);
        size = n;
    }

    int combinations(int n, int k) {
        if (k > n || k > size || n > size)
            throw new IllegalArgumentException();
        long result = f[n];
        result *= MathUtils.inverse(k, mod);
        result %= mod;
        result *= MathUtils.inverse(n - k, mod);
        return (int) (result % mod);
    }

    int factorial(int x) {
        if (x > size)
            throw new IllegalArgumentException();
        return f[x];
    }

    int arrangements(int n, int k) {
        if (n > size || k > size || k > n)
            throw new IllegalArgumentException();
        return (int) ((f[n] * ((long) MathUtils.inverse(f[n - k], mod))) % mod);
    }

    int b(int n, int k) {
        return combinations(n + k - 1, n - 1);
    }
}

class Tuple<T1, T2> {
    Tuple(T1 first, T2 second) {
        First = first;
        Second = second;
    }

    T1 First;
    T2 Second;
}

class Tuple3<T1, T2, T3> {
    Tuple3(T1 first, T2 second, T3 third) {
        First = first;
        Second = second;
        Third = third;
    }

    T1 First;
    T2 Second;
    T3 Third;
}

class MathUtils {
    static int ceilDiv(int a, int b) {
        return (a + b - 1) / b;
    }

    static boolean isPrime(int x) {
        for (long i = 2; i * i <= x; i++) {
            if (x % i == 0)
                return false;
        }
        return true;
    }

    static int getNextPrime(int x) {
        for (int i = x; ; i++) {
            if (isPrime(i))
                return i;
        }
    }

    static boolean[] eratosphen(int n) {
        boolean[] result = new boolean[n + 1];
        for (int i = 2; sqr((long) i) <= n; i++) {
            if (!result[i]) {
                for (int j = i * i; j <= n; j += i)
                    result[j] = true;
            }
        }
        return result;
    }

    static List<Tuple<Integer, Integer>> factorize(int x) {
        List<Tuple<Integer, Integer>> result = new ArrayList<Tuple<Integer, Integer>>();
        for (long div = 2; div * div <= x; div++) {
            if (x % div == 0) {
                int count = 0;
                do {
                    count++;
                    x /= div;
                }
                while (x % div == 0);
                result.add(new Tuple<Integer, Integer>((int) div, count));
            }
        }
        if (x != 1) {
            result.add(new Tuple<Integer, Integer>(x, 1));
        }
        return result;
    }

    static long lcm(int a, int b) {
        return ((long) a) * b / gcd(a, b);
    }

    static int gcd(int a, int b) {
        if (a <= 0 || b <= 0)
            throw new IllegalArgumentException("Not positive arguments: " + a + " and " + b);
        return privateGcd(Math.min(a, b), Math.max(a, b));
    }

    private static int privateGcd(int a, int b) {
        if (a == 0)
            return b;
        return privateGcd(b % a, a);
    }

    static double sqr(double a) {
        return a * a;
    }

    static long sqr(long a) {
        return a * a;
    }

    static int sqr(int a) {
        return a * a;
    }

    static int power(int base, int pow, int mod) {
        long s = base;
        long result = 1;
        while (pow != 0) {
            if ((pow & 1) > 0) {
                result *= s;
                result %= mod;
            }
            s = sqr(s) % mod;
            pow >>= 1;
        }
        return (int) result;
    }

    static int inverse(int x, int mod) {
        return power(x, mod - 2, mod);
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public double nextDouble(){
        return Double.parseDouble(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong(){
        return Long.parseLong(next());
    }
}