Now loop over each class. And from "X" subset the features corresponding to the current class "c". Using that calculate the probability of that class "c" occurring in the training data. This is calculated by: (Total No of times class "c" occurred)/Total No of classes
