/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <ext/random>
#include <ext/rope>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vl = std::vector<int64>;
using pii = std::pair<int, int>;
using pii = std::pair<int, int>;
using pll = std::pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(_) (_).begin(), (_).end()
#define rall(_) (_).rbegin(), (_).rend()
#define print(_) std::cout << (_) << '\n'
#define debug(_) std::cerr << #_ << ": " << (_) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << '{';
  for (size_t i = 0; i < vec.size(); ++i) {
    os << vec[i];
    if (i != vec.size() - 1) os << ',';
  }
  os << '}';
  return os;
}
template<typename T, typename U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '{' << p.first << " " << p.second << '}';
}
// constant
const int INF = (1<<30) - 1;  // 1.073741823e9
const int64 INF64 = (1LL<<62) - 1;  // 4.611686018427387903e18
const int MOD = 1000000007;

class SegmentTree {
 public:
  SegmentTree(const std::vector<int>& vec, const int& initial_value,
               std::function<int(int, int)> operation)
      : initial_value_(initial_value), vec_(vec), operation_(operation) {
    Initialize();
  }
  void Update(int position, int new_value);
  int Query(int a, int b);

 private:
  int n_;
  const int initial_value_;
  const std::vector<int> vec_;
  std::vector<int> data_;
  std::function<int(int, int)> operation_;
  void Initialize();
};

inline void SegmentTree::Initialize() {
  int vsize = static_cast<int>(vec_.size());
  n_ = 1;
  while (n_ < vsize) {
    n_ <<= 1;
  }
  data_.assign(2 * n_, initial_value_);
  for (int i = 0; i < vsize; ++i) {
    data_[i + n_] = vec_[i];
  }
  for (int i = n_ - 1; i > 0; --i) {
    data_[i] = operation_(data_[2 * i], data_[2 * i + 1]);
  }
}

inline void SegmentTree::Update(int position, int new_value) {
  position += n_;
  data_[position] = new_value;
  while (position > 0) {
    position >>= 1;
    data_[position] = operation_(data_[2 * position], data_[2 * position + 1]);
  }
}

// return Query[a, b)
inline int SegmentTree::Query(int a, int b) {
  int vl = initial_value_, vr = initial_value_;
  for (a += n_, b += n_; a < b; a >>= 1, b >>= 1) {
    if (a & 1) vl = operation_(vl, data_[a++]);
    if (b & 1) vr = operation_(data_[--b], vr);
  }
  return operation_(vl, vr);
}


int main(){
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, t; cin >> n >> t;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  auto f = [](int x, int y) {return max(x, y);};
  SegmentTree seg(a, -1, f);
  priority_queue<int> pq;

  for (int i = 0; i < n - 1; ++i) {
    int diff = seg.Query(i + 1, n) - a[i];
    pq.push(diff);
    //debug(diff);
  }

  int mx = 1;
  int top = pq.top();
  //debug(top);
  pq.pop();

  while (!pq.empty() && pq.top() == top) {
    ++mx;
    pq.pop();
  }

  cout << mx << '\n';

  return 0;
}

Measured memory_bytes: 2684