#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e5;
int ar[27];
int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    ar[s[i] - 'a'] = 1;
  }
  for (int i = 0; i < 26; i++) {
    if (ar[i]) cnt++;
  }
  if (k > 26)
    cout << "impossible" << endl;
  else if (k > s.size()) {
    cout << "impossible" << endl;
  } else if (cnt < k) {
    cout << k - cnt << endl;
  } else
    cout << 0 << endl;
  return 0;
}
