Obama says fight against Islamic State group will take time