Agricultural risk and the spread of religious communities