A suicide bombing at an education centre in Afghanistan has killed at least 24 people, including students.