select distinct extract(month from principal.vencimento) mes, extract(year from principal.vencimento) ano from contas_pagar principal where principal.vencimento < current_date order by extract(year from principal.vencimento),extract(month from principal.vencimento)