MI5 diverts record amount of budget to fight terrorism