First-principles study of solid solution strengthening in Mg–X (X=Al, Er) alloys