#include<bits/stdc++.h>
#define INF (1e9)
#define N 100005
using namespace std;
int n,t,a[N],maxabs,mina=INF;
bool f[N];

int main(){
  cin>>n>>t;
  for(int i=0;i<n;i++){
    cin>>a[i];
    maxabs=max(maxabs,a[i]-mina);
    mina=min(mina,a[i]);
  }
  mina=INF;
  int ans=0;
  for(int i=0;i<n;i++){
    if(maxabs==a[i]-mina)ans++;
    mina=min(mina,a[i]);
  }
  cout<<ans<<endl;
  return 0;
}
