#include <bits/stdc++.h>   using namespace std;   int main() {     int x, a, b, i, j, k, siz, cnt = 0, p, q, s, t, z, h, po;     string str;     cin >> str;     cin >> x;     siz = str.size();     for (i = 0; i < siz; i++) {       if (str[i] !=  *  && str[i] !=  ? ) cnt++;     }     p = siz - cnt;     q = cnt - p;     if (x < q)       cout <<  Impossible  << endl;     else if (x >= q && x <= cnt) {       s = 0;       t = cnt - x;       for (i = 0; i < siz; i++) {         if (s < t && (str[i + 1] ==  ?  || str[i + 1] ==  * )) {           s++;         } else {           if (str[i] >=  a  && str[i] <=  z ) cout << str[i];         }       }     } else {       z = x - cnt;       h = 0;       for (i = 0; i < siz; i++) {         if (str[i] ==  * ) {           h++;           po = i;           break;         }       }       if (h == 0)         cout <<  Impossible  << endl;       else {         for (i = 0; i < siz; i++) {           if (i == po) {             for (j = 1; j <= z; j++) {               cout << str[i - 1];             }           } else {             if (str[i] >=  a  && str[i] <=  z ) {               cout << str[i];             }           }         }       }     }     return 0;   }   