n, m = gets.split.map(&:to_i)
arr = readlines.map(&:chomp).map(&:split).map do |i|
  i.map(&:to_i)
end

likes = []
n.times do |i|
  likes << arr[i][1..-1]
end

likes.flatten!

ans = 0
likes.map do |i|
  if likes.count(i) == n
    ans += 1
  end
end

p ans / n
