#include <bits/stdc++.h>
using namespace std;
char S[10005];
set<int> s;
int main() {
  int i, j, t, n, m, k, l, r, temp, mini, maxi, flag, cnt;
  scanf("%s%d", S, &k);
  for (int i = 0; i < S[i]; i++) s.insert(S[i] - 'a');
  temp = strlen(S);
  if (temp < k)
    printf("impossible\n");
  else {
    m = s.size();
    printf("%d\n", max(0, k - m));
  }
  return 0;
}
