#include <bits/stdc++.h>
using namespace std;
char s[1005], re[1005];
int c1[27], c2[27], n, tt[27];
int jd(int x) {
  int i, tot = n, t1;
  memset(c2, 0, sizeof(c2));
  for (i = 0; i < 27; i++)
    if (c1[i]) {
      t1 = (c1[i] + x - 1) / x;
      if (tot < t1) return 0;
      tot -= t1;
      c2[i] = t1;
    }
  c2[0] += tot;
  for (i = 0; i < 27; i++) tt[i] = c2[i];
  return 1;
}
int main() {
  int i, j, cnt, l;
  while (scanf("%s%d", &s, &n) == 2) {
    l = strlen(s);
    memset(c1, 0, sizeof(c1));
    for (i = 0; i < l; i++) c1[s[i] - 'a']++;
    cnt = 0;
    for (i = 0; i < 27; i++)
      if (c1[i]) cnt++;
    if (n < cnt)
      printf("-1\n");
    else if (n >= l) {
      printf("1\n");
      printf("%s", s);
      for (i = 0; i < n - l; i++) printf("a");
      printf("\n");
    } else {
      int l1 = 1, r1 = l + 1, mid;
      while (l1 < r1) {
        mid = (l1 + r1) / 2;
        if (jd(mid))
          r1 = mid;
        else
          l1 = mid + 1;
      }
      printf("%d\n", l1);
      for (i = 0; i < 27; i++)
        if (tt[i]) {
          for (j = 0; j < tt[i]; j++) printf("%c", i + 'a');
        }
      printf("\n");
    }
  }
  return 0;
}
