#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n,_,*a=map(int,open(0).read().split())\n"
"m=d=c=0\n"
"for t in a[::-1]:\n"
"    if t>m:\n"
"        m=t\n"
"    if m-t>d:\n"
"        d=m-t\n"
"        c=1\n"
"    elif m-t==d:\n"
"        c+=1\n"
"print(c)\n"
"\"";
  system(s);
  return 0;
}            