local n, m = io.read("*n", "*n") local t = {} for i = 1, n do local a = io.read("*n") % m if t[a] then t[a] = t[a] + 1 else t[a] = 1 end end local r = 0 for k, v in pairs(t) do if k == 0 then r = r + 1 else local inv = m - k if t[inv] then if v == t[inv] then if k == inv then r = r + 1 elseif k < inv then r = r + v end elseif t[inv] < v then r = r + v end else r = r + v end end end print(r)