Complex organic molecules in diffuse clouds along the line of sight to Sagittarius B2