#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[1001];
  scanf("%s", s);
  int k, u = 0, v = 0;
  cin >> k;
  int a[26] = {0};
  if (strlen(s) < k)
    cout << "impossible";
  else {
    for (int i = 0; i < strlen(s); i++) {
      a[s[i] - 97]++;
    }
    for (int i = 0; i < 26; i++) {
      if (a[i] != 0) u++;
      if (a[i] == 0) v++;
    }
    if (u >= k)
      cout << "0";
    else
      cout << k - u;
  }
  return 0;
}
