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