n, k = map(int, input().split()) nums = list(map(int, input().split())) sum = 0 for num in nums: if num // 10 == k: sum += num print(sum)