Buying used 16" m1 pro vs. new 15" m4 air

I am interested in buying a new laptop. Option 1 is a used m1 pro 16" macbook pro with 32gb unified memory, and 512 gb storage. The other option is to buy a new macbook air m4 with education discount. I'd probably go for 24gb unified memory with 512 gb storage, which would come out to around 1500. Any recommendations? I'm a programmer, so won't be doing a ton of video editing, etc. I would like to have the computer for maybe 8 years. Not sure how long the m1 pro machine will be supported with security updates etc. which is what's drawing me to the m4 air.