Is K-NN applicable for binary variables?
Yes, you just have to find a suitable distance metric, instead of using the default Euclidean distance. Euclidean distance will work, but it loses a lot of its positive points when used on a non-euclidean space.

For you specific case, the Jaccard distance basically measures how many 1's are equal on both instances, ignoring the dimensions where both are 0's. This gives an interpretation like "if a program has a course, but the other doesn't, then they are dissimilar". Jaccard index is very useful in high-dimensional boolean matrices, such as generated by one-hot encodings.

Other more intuitive choice is the perfect match distance, which would simply measure how many dimensions are different for the two instances and can be easily computed by $\sum_{i=1}^n |X_i - Y_i|$. In this case, the interpretation becomes similar to "if both programs have a course, or both program don't have a course, then they're similar".

However, be careful with the K value of your K-NN. You only have two instances of class B, so you will have to choose 1 or 2 (technically at most 3) for the value of K.