How to Prevent a Many to Many When Number of Rows Shared Is Unknown
The better solution is creating the intermediate table subject_user:

table name: User_Subject
Fields: idUser, idSubject
PK: idUser, idSubject


Make both ids primary key, so one user cannot have two or more times the same subject. In other words, a subject cannot have the same student two or more times.