alias LL = Int64 macro chmin(x, y); {{x}} = {{y}} if {{x}} > {{y}}; end macro chmax(x, y); {{x}} = {{y}} if {{x}} < {{y}}; end macro yn(x); {{x}} ? "Yes" : "No"; end # ---------------------------------------------------- :) n, m = read_line.split.map(&.to_i64) a = read_line.split.map(&.to_i64.% m) amax = a.max at = a.tally b = at.to_a.sort_by!{|e| -e[1]} at.size.times do |i| num, cnt = b[i] next at[0] = 1 if num == 0 next if at[num] == 0 j = m - num while j <= amax if at[j]? at[j] = 0 end j += m end end puts at.values.sum