Both MD as well as MS are 3 year courses. One studies specialised subjects as opposed to MBBS where the syllabus is a gist of all the branches of medicine.