#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  string s;
  int k;
  int letters[26] = {0};
  cin >> s >> k;
  long size = s.size();
  if (size < k) {
    cout << "impossible" << endl;
  } else {
    for (int i = 0; i < size; i++) {
      letters[s[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      if (letters[i] > 0) {
        k--;
      }
    }
    if (k < 0) {
      cout << 0 << endl;
    } else {
      cout << k << endl;
    }
  }
  return 0;
}
