Hungary and Poland have vetoed a statement by European Union leaders laying out their migration priorities in a symbolic gesture of protest.