I'd actually put it at "at least" 7 years from launch, because I don't see them supporting Apple Silicon Macs for a shorter time than they support iPhones. That said, I'd say the M1 generation actually launched in late 2020 (before M1 Pro / Max were out). I think that it is likely that they'll drop support for all M1 systems at the same time. So, the first OS which "might not" support your system would be macOS 18, releasing in late 2027. Also, it is likely that you will get OS updates but miss out on features going to newer systems for some of this time — like how there are still Intel Macs that can upgrade to Sequoia but they won't be able to use Apple Intelligence.
Apple doesn't announce their support timeframe for products in advance, and their "methodology" for deciding which systems to support and not support with each new OS release is not entirely predictable. So, you've just got to tune in after WWDC each June and see which Macs are getting chopped off.
But, after Apple stops offering new major OS updates for your system, you still get security updates for two more years.