#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param students int整型一维数组 
# @param sandwiches int整型一维数组 
# @return int整型
#
class Solution:
    def countStudents(self , students: List[int], sandwiches: List[int]) -> int:
        # write code here
        # 用于记录无法拿到三明治的学生人数
        unable_to_get_sandwich = 0
        # 用于记录连续不匹配的次数
        consecutive_no_match = 0
        while students:
            if sandwiches and sandwiches[0] == students[0]:
                students.pop(0)
                sandwiches.pop(0)
                consecutive_no_match = 0
            else:
                students.append(students.pop(0))
                consecutive_no_match += 1
            if consecutive_no_match == len(sandwiches):
                unable_to_get_sandwich = len(sandwiches)
                break
        return unable_to_get_sandwich