#include<stdio.h>
#include<string.h>
#include<math.h>
long f(int x){
int a;
double b;
b=sqrt((double)x)-(int)sqrt((double)x);
if(b>0.0)
b=(int)sqrt((double)x)+1;
else
b=(int)sqrt((double)x);
return 10*(int)b;
}
void main(){
int n,k,a[100001],i,j;
scanf("%d %d",&n,&k);
i=1;
while(n--){
scanf("%d",&a[i++]);
for(j=1;j<=k;j++){
a[i-1]=f(a[i-1]);
if(a[i-1]==100)
break;
}
printf("%d\n",a[i-1]);
}
}