#include <bits/stdc++.h>
using namespace std;
char s[1010];
int cnt[30] = {0}, n, len, cNum = 0;
int use[30] = {0}, t;
vector<int> v;
bool comp(const int &a, const int &b) {
  int i = cnt[a] / use[a] + (cnt[a] % use[a] == 0 ? 0 : 1);
  int j = cnt[b] / use[b] + (cnt[b] % use[b] == 0 ? 0 : 1);
  return i < j;
}
int main() {
  gets(s);
  scanf(" %d", &n);
  len = strlen(s);
  for (int i = 0; i < len; i++) cnt[s[i] - 'a']++;
  for (int i = 0; i < 26; i++) {
    if (cnt[i] > 0) {
      cNum++;
      use[i] = 1;
      v.push_back(i);
    }
  }
  make_heap(v.begin(), v.end(), comp);
  if (cNum > n) {
    puts("-1");
  } else if (n >= len) {
    puts("1");
    printf("%s", s);
    n -= len;
    while (n--) printf("a");
    printf("\n");
  } else {
    n -= cNum;
    while (n--) {
      t = v.front();
      pop_heap(v.begin(), v.end(), comp);
      v.pop_back();
      use[t]++;
      v.push_back(t);
      push_heap(v.begin(), v.end(), comp);
    }
    t = v.front();
    n = cnt[t] / use[t] + (cnt[t] % use[t] == 0 ? 0 : 1);
    printf("%d\n", n);
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < use[i]; j++) printf("%c", i + 'a');
    }
    printf("\n");
  }
  return 0;
}
