parts = ["M1", "S2", "M1", "M1", "B3", "S2"]
limit = 2
answer = []
count = 1
parts.sort()
for i in range(len(parts)-1):
if parts[i] == parts[i+1]:
count += 1
if count > limit:
answer.append(parts[i])
else:
count = 1
print(answer)
To embed this project on your website, copy the following code and paste it into your website's HTML: