import java.io.{BufferedReader, IOException, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.ArrayBuffer

object Main {
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()
    val T = sc.nextInt()
    val A = Array.ofDim[Int](N + 1)
    (1 to N) foreach (i => A(i) = sc.nextInt())

    // 無駄にDP
    val a_min = Array.ofDim[Int](N + 1)
    a_min(0) = Integer.MAX_VALUE
    val aa_max = Array.ofDim[Int](N + 1)
    val aa_max_cnt = Array.ofDim[Int](N + 1)

    (1 to N) foreach { i =>
      a_min(i) = min(a_min(i - 1), A(i))
      val aa = A(i) - a_min(i)
      aa_max(i) = max(aa_max(i - 1), aa)
      aa_max_cnt(i) =
        if (aa_max(i) != aa_max(i - 1))
          1
        else
          aa_max_cnt(i - 1) + (if (aa_max(i) == aa) 1 else 0)
    }

    println(aa_max_cnt(N))
  }

  def main(args: Array[String]): Unit = {
    solve()
  }



  class InputReader(val stream: InputStream) {
    val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}
