#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param students int整型一维数组 
# @param sandwiches int整型一维数组 
# @return int整型
#
class Solution:
    def countStudents(self , students: List[int], sandwiches: List[int]) -> int:
        # write code here
        num = 0
        while len(students) != 0:
            if students[0] == sandwiches[0]:
                students.pop(0)
                sandwiches.pop(0)
                num = 0
            else:
                students.append(students.pop(0))
                num += 1
                if num > len(students):
                    return len(students)
        return 0