import scala.io.StdIn.{readInt,readLine}

object Main {
  def main(args:Array[String]) = {
    val n = readInt
    val m = readInt
    val target = readLine.split(" ").map(_.toInt)
    val score = new Array[Int](n)
    for(i<-0 until m) {
      val guess = readLine.split(" ").map(_.toInt)
      val t = target(i)
      for(j<-0 until guess.length) {
        if(guess(j)==t) score(j) += 1
        else score(t-1) += 1
      }
    }
    println(score.mkString("\n"))
  }
}