#include <bits/stdc++.h>
using namespace std;
int used[26];
int num[10];
vector<pair<int, bool>> v;
int code1[6];
int code[6];
int k[1000100];
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  for (int i = 0; i < s.length(); i++) {
    used[s[i] - 'a'] = true;
  }
  int sum = 0;
  for (int i = 0; i < 26; i++) {
    sum += used[i];
  }
  if (n > s.length()) {
    cout << "impossible";
  } else {
    cout << max(n - sum, 0);
  }
}
