by@tyage
AC
1230ms
for([a,b]=(0+require('fs').readFileSync(i=0)).split` `;i<a;)console.log(`*${'* '[i++>0&i<a].repeat(b-2)}*`)
18 36
************************************ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ************************************