Subtraction algebras and $BCK$-algebras