Associated production of heavy flavors and W, Z bosons at CMS