fun main(args:Array<String>) {
	val(n,t)= readLine()!!.split(" ").map {it.toInt()}
	val a= readLine()!!.split(" ").map {it.toInt()}
	
	var min=1000010000
	var maxDiff=0
	var count = 0
	for(i in a.indices){
		val diff=a[i]-min
		if(diff<0){
			min = a[i]
		}else if(diff==maxDiff){
			count++
		}else if(diff>maxDiff){
			maxDiff=diff
			count=1
		}
	}
	println(count)
	
}