#include <bits/stdc++.h>
using namespace std;
int n, h[260], f = 1, c, g, i;
string s;
int main() {
  cin >> s >> n;
  if (n > s.length()) return cout << "impossible", 0;
  for (i = 0; i < s.length(); i++) h[s[i]]++;
  for (i = 97; i <= 122; i++)
    if (h[i] > 0) g++;
  if (g < n)
    c = n - g;
  else
    f = 1;
l:
  if (f == 1)
    cout << c;
  else
    cout << "impossible";
}
