object Main {
  def main(args: Array[String]): Unit = {
    type Count = Int
    val Array(n, _) = io.StdIn.readLine().split(" ").map(_.toInt)
    val coins: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt)
    val heap = collection.mutable.PriorityQueue.empty[(Count, Int)](Ordering.by(- _._1))
    heap.enqueue((0, n))

    def loop(): Count = heap.dequeue() match {
      case (count, 0) => count
      case (count, sum) =>
        coins foreach (v => if (v <= sum) heap.enqueue((count+1, sum-v)))
        loop()
    }

    println(loop())
  }
}