#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  int k;
  cin >> s >> k;
  int a[26] = {0};
  int ava = 0, count = 0;
  for (int i = 0; i < s.length(); i++) {
    a[s[i] - 97]++;
  }
  for (int i = 0; i <= 25; i++) {
    if (a[i]) {
      count++;
    } else {
      ava++;
    }
  }
  int res = k - count;
  if (s.length() < k) {
    cout << "impossible" << endl;
  } else if (res <= 0) {
    cout << 0 << endl;
  } else if (ava >= res) {
    cout << res << endl;
  } else {
    cout << "impossible" << endl;
  }
  return 0;
}
