#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  cin >> s;
  cin >> n;
  if (s.size() < n)
    cout << "impossible";
  else {
    int a[26] = {0}, count1 = 0;
    for (int i = 0; i < s.size(); i++) a[s[i] - 'a']++;
    for (int i = 0; i < 26; i++)
      if (a[i] != 0) count1++;
    if (count1 >= n)
      cout << 0;
    else
      cout << n - count1;
  }
  return 0;
}
