Ariad posts 2Q profit on cancer drug payments