Towards a Theory of Maximal Extractable Value I: Constant Function Market Makers