How two oil-rich economies bounced back