Motte, Cardinals agree to 2-year, $12 million deal