ARM A: Patients receive azacitidine subcutaneously (SC) on days 1-6 and 8-10 and entinostat orally (PO) on days 3 and 10. Treatment repeats every 28 days for 2 courses in the absence of disease progression or unacceptable toxicity. Patients with stable or progressive disease receive chemotherapy of the treating oncologist's choice comprising irinotecan hydrochloride intravenously (IV) on day 1, docetaxel IV on day 1, pemetrexed disodium IV on day 1, or gemcitabine hydrochloride IV on days 1 and 8. Treatment repeats every 21 days in the absence of disease progression or unacceptable toxicity.