Brexit and counter-terror measures will dominate the next two years of Parliament's legislative programme.