import sys
try:
    from future_builtins import map
except ImportError:
    pass
file = sys.stdin
n, k = map(int, next(file).split())
print(sum(1 for i in map(int, file) if i % k == 0))
Same code slower in Python3 as compared to Python2