Target second-quarter profit beats expectations