There is a classroom which has M rows of benches in it. Also, N students will arrive one-by-one and take a seat.
Every student has a preferred row number(rows are numbered 1 to M and all rows have a maximum capacity K. Now, the students come one by one starting from 1 to N and follow these rules for seating arrangements:
Monk wants to know the total number of students who didn't get to sit in their preferred row. (This includes the students that did not get a seat at all)
Output the total number of students who didn't get to sit in their preferred row.
Student 4 and student 5 did not get their preferred seats.