simple Javascript solution
\nvar countStudents = function(students, sandwiches) {\nwhile (students.length>0 && students.indexOf(sandwiches[0])!=-1) {\n    if (students[0] == sandwiches[0]
```\nvar countStudents = function(students, sandwiches) {\nwhile (students.length>0 && students.indexOf(sandwiches[0])!=-1) {\n    if (students[0] == sandwiches[0]) {\n        students.shift();\n        sandwiches.shift();\n    }\n    else students.push(students.shift());\n}\nreturn students.length\n};\n```
['JavaScript']