import io.StdIn.readLine


object Main {

  def main(args: Array[String]): Unit = {
    val Array(n, t) = readLine().split(' ').map(_.toInt)
    val a = readLine().split(' ').map(_.toInt)

    var tmp = 0
    val b = (a.reverse.map { x =>
      if (x > tmp) tmp = x
      tmp
    }).reverse
    val rew = (1 to (n - 1)).groupBy(i => b(i - 1) - a(i - 1))
    println(rew(rew.keys.max).length)
  }

}
