The Arithmetic-Geometric Mean and Periods of Curves of Genus 1 and 2