Resolved atomic lines reveal outflows in two ultraluminous X-ray sources