Calculation of radiative transfer in nongray gas using a narrow-band model and Monte Carlo simulation