Form 1120-S Schedule M-2 and schedule L questions

I was wondering if the final amount on line 8 of schedule M-2 should be equal to the ending balance in my bank account for the year. I’m also wondering if this is the figure that will need to match the starting value of next year’s tax return? For some reason, when line 8 of schedule M-2 is equal to my ending bank account balance, then the retained earnings at the end of the year on schedule L are not equal to my assets (bank balance plus inventory value). But if I adjust the figures so that my retained earnings on schedule L match up with my assets, then the amount in schedule M-2 line 8 is a few hundred dollars less than my ending bank balance. So that's why I'm wondering if that line is supposed to equal my bank balance and if this is the figure that the IRS will look at next year for my starting value or if that's something else. Thanks for any help!