#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 32) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = vals.size();
    ll last_j = 1;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i < vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
      // bool is_end = true;
      // for (int j = last_j;  j <= vals.size(); j++) {
      //
      //   if ((j - i) >= vals_count) {
      //     debug(i, j, vals_count);
      //     min_broke_val = min(min_broke_val, n - (vals_sum[j] - vals_sum[i]));
      //     last_j = j;
      //     is_end = false;
      //     break;
      //   }
      // }
      // if (is_end) {
      //   debug(i, vals.size(), is_end);
      //
      //   break;
      // }
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    if (vals.size() == 1) {
      cout << 0;
      return 0;
    }
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 15) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = vals.size();
    ll last_j = 1;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i <= vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
      // bool is_end = true;
      // for (int j = last_j;  j <= vals.size(); j++) {
      //
      //   if ((j - i) >= vals_count) {
      //     debug(i, j, vals_count);
      //     min_broke_val = min(min_broke_val, n - (vals_sum[j] - vals_sum[i]));
      //     last_j = j;
      //     is_end = false;
      //     break;
      //   }
      // }
      // if (is_end) {
      //   debug(i, vals.size(), is_end);
      //
      //   break;
      // }
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    vll vals(400400, 0);
    vll vals_sum(400400, 0);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals[a[i]]++;
    }
    ll current_sum = 0;
    for (int i = 0; i < 400400; i++) {
      current_sum += vals[i];
      vals_sum[i] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 15) {
      cout << 0;
      return 0;
    }

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = 400400;
    for (int i = vals_count;  i < 400400; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i] - vals_sum[i-vals_count]));
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    if (vals.size() == 1) {
      cout << 0;
      return 0;
    }
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 32) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = n;
    ll last_j = 1;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i <= vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    if (vals.size() == 1) {
      cout << 0;
      return 0;
    }
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 32) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = vals.size();
    ll last_j = 1;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i <= vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
      // bool is_end = true;
      // for (int j = last_j;  j <= vals.size(); j++) {
      //
      //   if ((j - i) >= vals_count) {
      //     debug(i, j, vals_count);
      //     min_broke_val = min(min_broke_val, n - (vals_sum[j] - vals_sum[i]));
      //     last_j = j;
      //     is_end = false;
      //     break;
      //   }
      // }
      // if (is_end) {
      //   debug(i, vals.size(), is_end);
      //
      //   break;
      // }
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 15) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = 400400;
    ll last_j = 1;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i < vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
      // bool is_end = true;
      // for (int j = last_j;  j <= vals.size(); j++) {
      //
      //   if ((j - i) >= vals_count) {
      //     debug(i, j, vals_count);
      //     min_broke_val = min(min_broke_val, n - (vals_sum[j] - vals_sum[i]));
      //     last_j = j;
      //     is_end = false;
      //     break;
      //   }
      // }
      // if (is_end) {
      //   debug(i, vals.size(), is_end);
      //
      //   break;
      // }
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }

    sort(vals);

    vll vals_sum(vals.size()+1);
    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }

    if (((disk_space * 8) / n) > 32) { //check for overflow
      cout << 0;
      return 0;
    }

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = n;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i <= vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 15) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = 400400;
    ll last_j = 1;
    for (int i = 0;  i < vals.size(); i++) {
      bool is_end = true;
      for (int j = last_j;  j <= vals.size(); j++) {

        if ((vals[j-1] - vals[i]) >= vals_count) {
          debug(i, j, vals_count);
          min_broke_val = min(min_broke_val, n - (vals_sum[j-1] - vals_sum[i]));
          last_j = j;
          is_end = false;
          break;
        }
      }
      if (is_end) {
        debug(i, vals.size(), is_end);
        min_broke_val = min(min_broke_val, n - (vals_sum[vals.size()] - vals_sum[i]));
        break;
      }
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    if (vals.size() == 1) {
      cout << 0;
      return 0;
    }
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 15) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = 400400;
    ll last_j = 1;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i <= vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
      // bool is_end = true;
      // for (int j = last_j;  j <= vals.size(); j++) {
      //
      //   if ((j - i) >= vals_count) {
      //     debug(i, j, vals_count);
      //     min_broke_val = min(min_broke_val, n - (vals_sum[j] - vals_sum[i]));
      //     last_j = j;
      //     is_end = false;
      //     break;
      //   }
      // }
      // if (is_end) {
      //   debug(i, vals.size(), is_end);
      //
      //   break;
      // }
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T>& val) {
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T>& val) {
  return val.first + val.second;
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n, disk_space;
    cin >> n >> disk_space;

    vll a(n);
    //vll vals(400400, 0);

    map<ll, ll> vals_with_count;
    vll vals;

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vals_with_count[a[i]]++;
    }

    for (auto& el: vals_with_count) {
      vals.pb(el.first);
    }
    sort(vals);
    if (vals.size() == 1) {
      cout << 0;
      return 0;
    }
    vll vals_sum(vals.size()+1);

    ll current_sum = 0;
    for (int i = 0; i < vals.size(); i++) {
      current_sum += vals_with_count[vals[i]];
      vals_sum[i+1] = current_sum;
    }
    //check for overflow
    if (((disk_space * 8) / n) > 32) {
      cout << 0;
      return 0;
    }
    debug(vals, vals_sum);

    ll vals_count = pow(2, (disk_space * 8) / n);
    ll min_broke_val = vals.size();
    ll last_j = 1;

    if (vals.size() <= vals_count) {
      cout << 0;
      return 0;
    }

    for (int i = 0;  i < vals.size() - vals_count; i++) {
      min_broke_val = min(min_broke_val, n - (vals_sum[i+vals_count] - vals_sum[i]));
      // bool is_end = true;
      // for (int j = last_j;  j <= vals.size(); j++) {
      //
      //   if ((j - i) >= vals_count) {
      //     debug(i, j, vals_count);
      //     min_broke_val = min(min_broke_val, n - (vals_sum[j] - vals_sum[i]));
      //     last_j = j;
      //     is_end = false;
      //     break;
      //   }
      // }
      // if (is_end) {
      //   debug(i, vals.size(), is_end);
      //
      //   break;
      // }
    }

    cout << min_broke_val;

    return 0;
  }
};

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 4e5+10;
const ll mod = 1e9+7;

int n,I;
int a[N];
int sum[N];
map<int,int>vis;

ll fast_pow(ll a,int p){
    ll ans = 1;
    while(p){
        if(p&1) ans = ans*a;
        p >>= 1;
        a = a*a;
    }
    return ans;
}
int main(){
    scanf("%d%d",&n,&I);
    int m = n;
    for(int i = 1;i <= n;i++){
        scanf("%d",a+i);
        vis[a[i]]++;
    }
    int k = I*8/n;
    ll K = fast_pow(2ll,k);

    if(K > n){
        K = 1;
        while(K <= n){
            K = K*2;
        }
        K /= 2;
    }
    sort(a+1,a+1+n);
    n = unique(a+1,a+1+n)-(a+1);
    for(int i = 1;i <= n;i++){
        int x = vis[a[i]];
        sum[i] = x+sum[i-1];
    }
    int ans = 0;
    for(int i = 1;i <= n-K+1;i++){
        int l = i,r = i+K-1;
        if(sum[r]-sum[l-1] > ans){
            ans = sum[r]-sum[l-1];
        }
    }
    cout<<m-ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 4e5+10;
const ll mod = 1e9+7;

int a[N];
int sum[N];
map<int,int>vis;

int fast_pow(int a,int p){
    int ans = 1;
    while(p--){
        ans = ans*2;
    }
    return ans;
}
int main(){
    int n,I;
    scanf("%d%d",&n,&I);
    int m = n;
    for(int i = 1;i <= n;i++){
        scanf("%d",a+i);
        vis[a[i]]++;
    }
    int k = I*8/n;
    int K = fast_pow(2,k);
//    cout<<K<<endl;
    sort(a+1,a+1+n);
    n = unique(a+1,a+1+n)-(a+1);
    if(n < K){
        cout<<K-n<<endl;
        return 0;
    }
    for(int i = 1;i <= n;i++){
        int x = vis[a[i]];
        sum[i] = x+sum[i-1];
        //cout<<sum[i]<<" ";
    }
    //cout<<endl;
    int ans = 0;
    for(int i = 1;i <= n-K+1;i++){
        int l = i,r = i+K-1;

        //if(a[i]+K-1 != a[r]) continue;

        if(sum[r]-sum[l-1] > ans){
            ans = sum[r]-sum[l-1];
        }
    }
    cout<<m-ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 4e5+10;
const ll mod = 1e9+7;

int n,I;
int a[N];
int sum[N];
map<int,int>vis;

int fast_pow(int a,int p){
    int ans = 1;
    while(p--){
        ans = ans*2;
    }
    return ans;
}
int main(){
    scanf("%d%d",&n,&I);
    int m = n;
    for(int i = 1;i <= n;i++){
        scanf("%d",a+i);
        vis[a[i]]++;
    }
    int k = I*8/n;
    int K = fast_pow(2,k);
    sort(a+1,a+1+n);
    n = unique(a+1,a+1+n)-(a+1);
    for(int i = 1;i <= n;i++){
        int x = vis[a[i]];
        sum[i] = x+sum[i-1];
        //cout<<sum[i]<<" ";
    }
    //cout<<endl;
    int ans = 0;
    for(int i = 1;i <= n-K+1;i++){
        int l = i,r = i+K-1;

        //if(a[i]+K-1 != a[r]) continue;

        if(sum[r]-sum[l-1] > ans){
            ans = sum[r]-sum[l-1];
        }
    }
    cout<<m-ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define MAXN 400001
using namespace std;

int n, i, k, v, cnt, sum, Max, a[MAXN];
map<int, int> num;

int main()
{
    scanf("%d%d", &n, &i);
    if (i * 8 / n >= ceil(log2(n)))
    {
        printf("0\n");
        return 0;
    }
    k = min((int)pow(2, i * 8 / n), n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &v);
        num[v]++;
    }
    for (auto it : num)
        a[cnt++] = it.second;
    for (int i = 0; i < k; i++)
        Max = sum += a[i];
    for (int i = k; i < cnt; i++)
    {
        sum += a[i];
        sum -= a[i - k];
        Max = max(Max, sum);
    }
    printf("%d\n", n - Max);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 4e5+10;
const ll mod = 1e9+7;

int n,I;
int a[N];
int sum[N];
map<int,int>vis;

int main(){
    scanf("%d%d",&n,&I);
    int m = n;
    for(int i = 1;i <= n;i++){
        scanf("%d",a+i);
        vis[a[i]]++;
    }
    int k = I*8/n;
    int K = 1;
    while(k&&K<=n){
        K = K*2;
        k--;
    }
    if(K > n){
        K /= 2;
    }
    sort(a+1,a+1+n);
    n = unique(a+1,a+1+n)-(a+1);
    for(int i = 1;i <= n;i++){
        int x = vis[a[i]];
        sum[i] = x+sum[i-1];
    }
    int ans = 0;
    for(int i = 1;i <= n-K+1;i++){
        int l = i,r = i+K-1;
        if(sum[r]-sum[l-1] > ans){
            ans = sum[r]-sum[l-1];
        }
    }
    cout<<m-ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        int n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        for(int i = 2; i <= n - 1; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i];
        }
        int mx = -9, ind;
        for(int i = m; i <= n; i++){
            if(i > m) pre[i] -= p[i - m];
            if(pre[i] > mx){
                mx = pre[i];
                ind = i;
            }
        }
        cout << mx << " " << ind << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        int n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        p[1] = 0;
        for(int i = 2; i <= n - 1; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i - 1];
        }
        int mx = -9, ind;
        for(int i = m; i <= n; i++){
            if(i > m) pre[i] -= p[i - m];
            if(pre[i] > mx){
                mx = pre[i];
                ind = i;
            }
        }
        cout << mx + 1 << " " << ind - m + 1 << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        ll n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        p[1] = 0;
        for(int i = 2; i < n; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i - 1];
        }
        pre[n] = pre[n - 1] + p[n - 1];
        ll mx = -9, ind;
        for(int i = m; i <= n; i++){
            ll x = pre[i];
            if(i > m) x -= pre[i - m + 2];
            if(x > mx){
                mx = x;
                ind = i;
            }
        }
        if(mx == 0) cout << "0 1" << endl;
        else cout << mx + 1 << " " << ind - m + 1 << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        int n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        for(int i = 2; i <= n - 1; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i];
        }
        int mx = -9, ind;
        for(int i = m; i <= n; i++){
            if(i > m) pre[i] -= p[i - m];
            if(pre[i] > mx){
                mx = pre[i];
                ind = i;
            }
        }
        cout << mx + 1 << " " << ind - m + 1 << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        ll n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        p[1] = 0;
        for(int i = 2; i < n; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i - 1];
        }
        pre[n] = pre[n - 1] + p[n - 1];
        ll mx = -9, ind;
        for(int i = m; i <= n; i++){
            if(i > m) pre[i] -= (pre[i - m] + p[i - m]);
            if(pre[i] > mx){
                mx = pre[i];
                ind = i;
            }
        }
        cout << mx + 1 << " " << ind - m + 1 << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        ll n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        p[1] = 0;
        for(int i = 2; i < n; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i - 1];
        }
        pre[n] = pre[n - 1] + p[n - 1];
        ll mx = -9, ind;
        for(int i = m; i <= n; i++){
            int x = pre[i];
            if(i > m) x -= pre[i - m + 2];
            if(x > mx){
                mx = x;
                ind = i;
            }
        }
        if(mx == 0) cout << "0 1" << endl;
        else cout << mx + 1 << " " << ind - m + 1 << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        ll n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        p[1] = 0;
        for(int i = 2; i < n; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i - 1];
        }
        pre[n] = pre[n - 1] + p[n - 1];
        ll mx = -9, ind;
        for(int i = m; i <= n; i++){
            int x = pre[i];
            if(i > m) x -= pre[i - m + 1];
            if(x > mx){
                mx = x;
                ind = i;
            }
        }
        if(mx == 0) cout << "0 1" << endl;
        else cout << mx + 1 << " " << ind - m + 1 << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 200005;
int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        int n, m, a[N], p[N], pre[N];
        cin >> n >> m;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        pre[1] = 0;
        p[1] = 0;
        for(int i = 2; i <= n; i++){
            if(a[i] > a[i - 1] && a[i] > a[i + 1]){
                p[i] = 1;
            }
            else p[i] = 0;
            pre[i] = pre[i - 1] + p[i - 1];
        }
        int mx = -9, ind;
        for(int i = m; i <= n; i++){
            if(i > m) pre[i] -= (pre[i - m] + p[i - m]);
            if(pre[i] > mx){
                mx = pre[i];
                ind = i;
            }
        }
        cout << mx + 1 << " " << ind - m + 1 << endl;
    }
}


#include <bits/stdc++.h>
int a[20001000]= {0};
using namespace std;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,k;
        scanf("%d %d",&n,&k);
        memset(a,0,sizeof(a));
        for(int i=1; i<=n; i++)
        {
            scanf("%d",&a[i]);
        }
        vector <int> v;
        for(int i=2; i<=n-1; i++)
        {
            if(a[i]>a[i-1]&&a[i]>a[i+1])
            {
                v.push_back(i);
            }
        }
        if(!v.empty())
        {
        int temp=1,ans=1,ansl=max(v[0]-k+2,1),l=max(v[0]-k+2,1),r=1+v[0];
            for(int i=1; i<v.size(); i++)
            {
                if(v[i]-(r-1)<=k-2)
                {
                    //printf("xx\n");
                    temp++;
                    r=r+2-k;
                    l=max(v[i]+2-k,1);
                }
                else
                {
                    //printf("%d\t%d\n",v[i],r);
                    if(ans<temp)
                    {
                        ansl=l;
                        ans=temp;
                    }
                    l=max(v[i]-k+2,1);
                    r=v[i]+1;
                    temp=1;
                }
                if(ans<temp)
                {
                    ansl=l;
                    ans=temp;
                }
            }
            printf("%d %d\n",ans+1,ansl);
        }
        else
        {
            printf("1 1");
        }
    }
}


#include <bits/stdc++.h>
int a[200010]= {0};
using namespace std;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,k;
        scanf("%d %d",&n,&k);
        memset(a,0,sizeof(a));
        for(int i=1; i<=n; i++)
        {
            scanf("%d",&a[i]);
        }
        vector <int> v;
        for(int i=2; i<=n-1; i++)
        {
            if(a[i]>a[i-1]&&a[i]>a[i+1])
            {
                v.push_back(i);
            }
        }
        if(!v.empty())
        {
        int temp=1,ans=1,ansl=max(v[0]-k+2,1),l=max(v[0]-k+2,1),r=1+v[0];
            for(int i=1; i<v.size(); i++)
            {
                if(v[i]-(r-1)<=k-2)
                {
                    //printf("xx\n");
                    temp++;
                    r=r+2-k;
                    l=max(v[i]+2-k,1);
                }
                else
                {
                    //printf("%d\t%d\n",v[i],r);
                    if(ans<temp)
                    {
                        ansl=l;
                        ans=temp;
                    }
                    l=max(v[i]-k+2,1);
                    r=v[i]+1;
                    temp=1;
                }
                if(ans<temp)
                {
                    ansl=l;
                    ans=temp;
                }
            }
            printf("%d %d\n",ans+1,ansl);
        }
        else
        {
            printf("1 1");
        }
    }
}


#include <bits/stdc++.h>
int a[20001000]= {0};
using namespace std;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,k;
        scanf("%d %d",&n,&k);
        memset(a,0,sizeof(a));
        for(int i=1; i<=n; i++)
        {
            scanf("%d",&a[i]);
        }
        vector <int> v;
        for(int i=2; i<=n-1; i++)
        {
            if(a[i]>a[i-1]&&a[i]>a[i+1])
            {
                v.push_back(i);
            }
        }
        int temp=1,ans=1,ansl=max(v[0]-k+2,1),l=max(v[0]-k+2,1),r=1+v[0];
        for(int i=1; i<v.size(); i++)
        {
            if(v[i]-(r-1)<=k-2)
            {
                //printf("xx\n");
                temp++;
                r=r+2-k;
                l=max(v[i]+2-k,1);
            }
            else
            {
                //printf("%d\t%d\n",v[i],r);
                if(ans<temp)
                {
                    ansl=l;
                    ans=temp;
                }
                l=max(v[i]-k+2,1);
                r=v[i]+1;
                temp=1;
            }
            if(ans<temp)
            {
                ansl=l;
                ans=temp;
            }
        }
        printf("%d %d\n",ans+1,ansl);
    }
}


#include <bits/stdc++.h>
        int a[200010*4]={0};
using namespace std;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,k;
        scanf("%d %d",&n,&k);
        memset(a,0,sizeof(a));
        for(int i=1; i<=n; i++)
        {
            scanf("%d",&a[i]);
        }
        vector <int> v;
        for(int i=2; i<=n-1; i++)
        {
            if(a[i]>a[i-1]&&a[i]>a[i+1])
            {
                v.push_back(i);
            }
        }
        int temp=1,ans=1,ansl=max(v[0]-k+2,1),l=max(v[0]-k+2,1),r=1+v[0];
        for(int i=1; i<v.size(); i++)
        {
            if(v[i]-(r-1)<=k-2)
            {
                //printf("xx\n");
                temp++;
                r=r+2-k;
                l=max(v[i]+2-k,1);
            }
            else
            {
                //printf("%d\t%d\n",v[i],r);
                if(ans<temp)
                {
                    ansl=l;
                    ans=temp;
                }
                l=max(v[i]-k+2,1);
                r=v[i]+1;
                temp=1;
            }
            if(ans<temp)
            {
                ansl=l;
                ans=temp;
            }
        }
        printf("%d %d\n",ans+1,ansl);
    }
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,k;
        scanf("%d %d",&n,&k);
        int a[200010];
        for(int i=1; i<=n; i++)
        {
            scanf("%d",&a[i]);
        }
        vector <int> v;
        for(int i=2; i<=n-1; i++)
        {
            if(a[i]>a[i-1]&&a[i]>a[i+1])
            {
                v.push_back(i);
            }
        }
        int temp=1,ans=1,ansl=max(v[0]-k+2,1),l=max(v[0]-k+2,1),r=1+v[0];
        for(int i=1; i<v.size(); i++)
        {
            if(v[i]-(r-1)<=k-2)
            {
                //printf("xx\n");
                temp++;
                r=r+2-k;
                l=max(v[i]+2-k,1);
            }
            else
            {
                //printf("%d\t%d\n",v[i],r);
                if(ans<temp)
                {
                    ansl=l;
                    ans=temp;
                }
                l=max(v[i]-k+2,1);
                r=v[i]+1;
                temp=1;
            }
            if(ans<temp)
            {
                ansl=l;
                ans=temp;
            }
        }
        printf("%d %d\n",ans+1,ansl);
    }
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+5];
    for(int i=0;i<n;i++) cin>>a[i];
      int b[n+5];
    b[0]=0;
    for(int i=1;i<n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n-1]=b[n-2];
    ll k1=0,mx=0;
    /*for(int i=0;i<n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k;i++)
    {
     if(b[i+k-2]-b[i-1]>mx)
     {
      mx=b[i+k-2]-b[i-1];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1+1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+1];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-1];
    ll k1=0,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+2;i++)
    {
     if(b[i+k-2]-b[i]>mx)
     {
      mx=b[i+k-2]-b[i];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+1];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-1];
    ll k1=0,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+1;i++)
    {
     if(b[i+k-2]-b[i-1]>mx)
     {
      mx=b[i+k-2]-b[i-1];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+1];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-1];
    ll k1=1,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+1;i++)
    {
     if(b[i+k-2]-b[i]>mx)
     {
      mx=b[i+k-2]-b[i];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+1];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-1];
    ll k1=0,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+2;i++)
    {
     if(b[i+k-2]-b[i]>mx)
     {
      mx=b[i+k-2]-b[i-1];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+5];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+5];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-2];
    ll k1=0,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+1;i++)
    {
     if(b[i+k-2]-b[i-1]>mx)
     {
      mx=b[i+k-2]-b[i-1];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+1];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-1];
    ll k1=0,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+2;i++)
    {
     if(b[i+k-2]-b[i-1]>mx)
     {
      mx=b[i+k-2]-b[i-1];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+1];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-2];
    ll k1=0,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+2;i++)
    {
     if(b[i+k-2]-b[i-1]>mx)
     {
      mx=b[i+k-2]-b[i-1];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element) != container.end())
#define ss  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define mod (1000000000 + 7)
#define inf (1e10+9)
#define fi first
#define se second
#define MAXN   1000001
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_set;

long long fastpow(long long n, long long x, long long m){

    long long ret = 1;

    while(x){
    if(x&1) (ret*=n)%=m;
    x>>=1;
    (n*=n)%=m;
    }

 return ret;
}
ll add(ll a,ll b){
  return((a%mod)+(b%mod))%mod;
}
ll prod(ll a,ll b){
  a%=mod;
  b%=mod;
  return ((a%mod)*(b%mod)%mod);
}
int main()
{

  ss;
  ll t,n,k,mx,k1,a,b,c,d,k2,k3,k4;
  cin>>t;
  while(t--)
  {
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
      int b[n+1];
    b[0]=0;
    b[1]=0;
    for(int i=2;i<=n-1;i++)
    {
     if(a[i]>a[i-1]&&a[i]>a[i+1])
     {
      b[i]=b[i-1]+1;
     }
     else
      b[i]=b[i-1];
    }
    b[n]=b[n-1];
    ll k1=0,mx=0;
    /*for(int i=1;i<=n;i++)
      cout<<b[i]<<" ";
    cout<<endl;*/
    for(int i=1;i<=n-k+1;i++)
    {
     if(b[i+k-2]-b[i]>mx)
     {
      mx=b[i+k-2]-b[i];
      k1=i;
     }
    }
    cout<<mx+1<<" "<<k1<<endl;

  }

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k;
        cin>>n>>k;

        vector<int> vec(n);

        for(int i=0;i<n;i++) cin>>vec[i];

        vector<int> freqVec(n,0);

        for(int i=0;i<n;i++){
            if(i!=0 && i!=n-1){
                if(vec[i]>vec[i-1] && vec[i]>vec[i+1])  freqVec[i]++;
            }
        }

        vector<int> prefixOfFreqVector(n);

        prefixOfFreqVector[0] = freqVec[0];

        for(int i=1;i<n;i++){
            prefixOfFreqVector[i]=prefixOfFreqVector[i-1]+freqVec[i];
        }

        int peak=0,low=0,l=0;

        while(true){
            int r=l+k-1;
            if(prefixOfFreqVector[r-1]-prefixOfFreqVector[l] > 0 && prefixOfFreqVector[r-1]-prefixOfFreqVector[l] > peak){
                peak = prefixOfFreqVector[r-1]-prefixOfFreqVector[l];
                low = l;
            }
            l++;
            if( r == n-1 ) break;
        }
        cout<<peak+1<<" "<<low+1<<"\n";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k,globLen = 0,globLow = 0;
        cin>>n>>k;

        vector<int> vec(n);
        vector<int> isPeak(n,0);
        vector<int> prefixPeak(n,0);

        for(int i=0;i<n;++i) cin>>vec[i];

        for(int i=1;i<n-1;++i){
            if(vec[i] > vec[i-1] && vec[i] > vec[i+1]) isPeak[i] =  1;
        }

        for(int i=1;i<n;++i){
            prefixPeak[i] = prefixPeak[i-1]+isPeak[i];
        }

        for(int i=0;i<=(n-k);++i){
            int localLen = 0;
            if(i == 0){
                localLen = prefixPeak[i+k-1];
                if(isPeak[i] == 1)localLen--;
                if(isPeak[i+k-1] == 1)localLen--;

                if(localLen > globLen){
                    globLen = localLen;
                    globLow = i;
                }
            } else {
                localLen = prefixPeak[i+k-1]-prefixPeak[i-1];
                if(isPeak[i] == 1)localLen--;
                if(isPeak[i+k-1] == 1)localLen--;

                if(localLen > globLen){
                    globLen = localLen;
                    globLow = i;
                }
            }
        }

        cout<<globLen+1<<" "<<globLow+1<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k;
        cin>>n>>k;
        vector<int> vec(n);

        for(int i=0;i<n;i++) cin>>vec[i];

        int l=0,r,peak=0,low=0;
        while(true){
            int tempPeak=0,tempLow;
            r=l+k-1;
            for(int i=l;i<=r;i++){
                if(i!=l && i!=r){
                    if(vec[i]>vec[i-1] && vec[i]>vec[i+1]){
                        tempPeak++;
                        tempLow = l;
                    }
                }
            }

            if(tempPeak > peak){
                peak = tempPeak;
                low = tempLow;
            }

            l++;

            if(r == n-1) {
                break;
            }
        }

        if(low != 0) cout<<peak+1<<" "<<low+1<<"\n";
        else cout<<peak+1<<" "<<low<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k;
        cin>>n>>k;
        vector<int> vec(n);

        for(int i=0;i<n;i++) cin>>vec[i];

        int l=0,r,peak=0,low=0;
        while(true){
            int tempPeak=0,tempLow;
            r=l+k-1;
            for(int i=l;i<=r;i++){
                if(i!=l && i!=r){
                    if(vec[i]>vec[i-1] && vec[i]>vec[i+1]){
                        tempPeak++;
                        tempLow = l;
                    }
                }
            }

            if(tempPeak > peak){
                peak = tempPeak;
                low = tempLow;
            }

            l++;

            if(r == n-1) {
                break;
            }
        }

        cout<<peak+1<<" "<<low+1<<"\n";

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k,len = -1,lef = -1;
        cin>>n>>k;

        vector<int> vec(n);
        queue<int> q;

        for(int i=0;i<n;++i) cin>>vec[i];

        for(int i=0;i<k;++i){
            if(i != 0 && i != k){
                if(vec[i] > vec[i-1] && vec[i] > vec[i+1]) q.push(i);
            }
        }

        if(!q.empty()){
            len  = q.size();
            lef = q.front();
        }

        for(int i=1;i<=(n-k);++i){
            int left = q.front();
            if(left == i) q.pop();

            int secLast = i+k-2;
            if(vec[secLast] > vec[secLast-1] && vec[secLast] > vec[secLast+1])q.push(secLast);

            if(q.size() > len){
                len = q.size();
                lef  = q.front();
            }
        }

        cout<<q.size()+1<<" "<<q.front()+1<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k;
        cin>>n>>k;
        vector<int> vec(n);

        for(int i=0;i<n;i++) cin>>vec[i];

        int l=0,r,peak=0,low=-1;
        while(true){
            int tempPeak=0,tempLow;
            r=l+k-1;
            for(int i=l;i<=r;i++){
                if(i!=l && i!=r){
                    if(vec[i]>vec[i-1] && vec[i]>vec[i+1]){
                        tempPeak++;
                        tempLow = l;
                    }
                }
            }

            if(tempPeak > peak){
                peak = tempPeak;
                low = tempLow;
            }

            l++;

            if(r == n-1) {
                break;
            }
        }

        if(low != -1) cout<<peak+1<<" "<<low+1<<"\n";
        else cout<<peak+1<<" "<<0<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k;
        cin>>n>>k;
        vector<int> vec(n);

        for(int i=0;i<n;i++) cin>>vec[i];

        int l=0,r,peak=0,low;
        while(true){
            int tempPeak=0,tempLow;
            r=l+k-1;
            for(int i=l;i<=r;i++){
                if(i!=l && i!=r){
                    if(vec[i]>vec[i-1] && vec[i]>vec[i+1]){
                        tempPeak++;
                        tempLow = l;
                    }
                }
            }

            if(tempPeak > peak){
                peak = tempPeak;
                low = tempLow;
            }

            l++;

            if(r == n-1) break;
        }

        cout<<peak+1<<" "<<low+1<<"\n";

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n,k;
        cin>>n>>k;

        vector<int> vec(n);
        for(int i=0;i<n;++i) cin>>vec[i];

        int globalLeft = -1,globalLen = -1;
        for(int i=0;i<=(n-k);++i){
            int localLen = 0;
            for(int j=i;j<(i+k);++j){
                if(j != i && j != (i+k-1)){
                    if(vec[j] > vec[j-1] && vec[j] > vec[j+1]) ++localLen;
                }
            }
            if(localLen > globalLen){
                globalLen = localLen;
                globalLeft = (i+1);
            }
        }
        cout<<globalLen+1<<" "<<globalLeft<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i]+=ans[i-1];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i]+=1;
        }

   }
   ans[n-1]=ans[n-2];
   int ma=INT_MIN;
   int in=0;
   for(int i=k-1;i<n;i++)
   {
    int pre=ma;
        ma=max(ma,ans[i-1]-ans[(i-(k-1)>0?i-(k-1)-1:i-(k-1))]);
        if(ma!=pre)
        {
            in=i-(k-1);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n+1]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i]+=ans[i-1];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i]+=1;
        }

   }
   ans[n-1]=ans[n-2];
   int ma=INT_MIN;
   int in=0;
   for(int i=k-1;i<n;i++)
   {
        int pre=ma;
        int t=ans[i-1]-ans[i-(k-1)];
       // if(i>0&&i<n-1&&a[i]>=a[i-1]&&a[i]>=a[i+1])t--;
        ma=max(ma,t);
        if(ma!=pre)
        {
            in=i-(k-1);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n+1]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i]+=ans[i-1];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i]+=1;
        }

   }
   ans[n-1]=ans[n-2];
   int ma=INT_MIN;
   int in=0;
   for(int i=k-1;i<n;i++)
   {
        int pre=ma;
        int t=ans[i]-ans[i-(k-1)];
        if(i>0&&i<n-1&&a[i]>=a[i-1]&&a[i]>=a[i+1])t--;
        ma=max(ma,t);
        if(ma!=pre)
        {
            in=i-(k-1);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n+1]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i]+=ans[i-1];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i]+=1;
        }

   }
   ans[n-1]=ans[n-2];
   int ma=INT_MIN;
   int in=0;
   for(int i=k-1;i<n;i++)
   {
        int pre=ma;
        int t=ans[i]-ans[i-(k-1)];
        if(i>0&&i<n&&a[i]>=a[i-1]&&a[i]>=a[i+1])t--;
        ma=max(ma,t);
        if(ma!=pre)
        {
            in=i-(k-1);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n+1]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i]+=ans[i-1];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i]+=1;
        }

   }
   ans[n-1]=ans[n-2];
   int ma=INT_MIN;
   int in=0;
   for(int i=k-1;i<=n;i++)
   {
        int pre=ma;
        int t=ans[i]-ans[i-(k-1)];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])t--;
        ma=max(ma,t);
        if(ma!=pre)
        {
            in=i-(k-1);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i]+=ans[i-1];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i+1]+=1;
        }

   }
   ans[n-1]+=ans[n-2];
   int ma=INT_MIN;
   int in=0;
   for(int i=k;i<n;i++)
   {
    int pre=ma;
        ma=max(ma,ans[i]-ans[i-(k-1)]);
        if(ma!=pre)
        {
            in=i-(k-1);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i]+=ans[i-1];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i+1]+=1;
        }

   }
   ans[n-1]+=ans[n-2];
   int ma=INT_MIN;
   int in=0;
   for(int i=k-1;i<n;i++)
   {
    int pre=ma;
        ma=max(ma,ans[i]-ans[i-(k-1)]);
        if(ma!=pre)
        {
            in=i-(k-1);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;
//int a,b;
//int p[1000000];

void solve(){
   int n,k;
   cin>>n>>k;
   int a[n];

   for(int i=0;i<n;i++)
   {
        cin>>a[i];

   }
   int ans[n+1]={0};
   for(int i=0;i<n;i++)
   {
        if(i==0||i==n-1)continue;
        ans[i+1]+=ans[i];
        if(a[i]>=a[i-1]&&a[i]>=a[i+1])
        {
            ans[i+1]+=1;
        }

   }
   ans[n]=ans[n-1];
   int ma=INT_MIN;
   int in=0;
   for(int i=k;i<=n;i++)
   {
        int pre=ma;
        ma=max(ma,ans[i-1]-ans[i-k]);
        if(ma!=pre&&i-2!=i-(k))
        {
            in=i-(k);
        }
   }
   cout<<ma+1<<" "<<in+1<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int tt;
    cin>>tt;

    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		ll a[n+1]={0},i;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		std::vector<pair<ll,ll> > v;
		ll x=0;
		//v.push_back(make_pair(x,0));
		v.push_back(make_pair(x,0));
		for(i=2;i<=n-1;i++)
		{
			if(a[i]>a[i-1]&&a[i]>a[i+1])
			{
				x++;
				v.push_back(make_pair(x,1));
			}
			else
			{
				v.push_back(make_pair(x,0));
			}
		}
		v.push_back(make_pair(x,0));
		ll maxi=0;
		ll y;
		pair<ll,ll> p1;
		pair<ll,ll> p2;
		ll z;
		for(i=0;i<v.size()-k+1;i++)
		{
			p1=v[i],p2=v[i+k-1];
			z=p2.first-p1.first;
			if(p1.second==1)
				z--;
			if(p2.second==1)
				z--;
			if(z>maxi)
			{
				maxi=z;
				y=i;
			}
		}
		v.clear();
		cout<<maxi+1<<" "<<y+1<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		ll a[n+1]={0},i;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		std::vector<pair<ll,ll> > v;
		ll x=0;
		v.push_back(make_pair(x,0));
		for(i=2;i<=n-1;i++)
		{
			if(a[i]>a[i-1]&&a[i]>a[i+1])
			{
				x++;
				v.push_back(make_pair(x,1));
			}
			else
			{
				v.push_back(make_pair(x,0));
			}
		}
		v.push_back(make_pair(x,0));
		ll maxi=0;
		ll y;
		pair<ll,ll> p1;
		pair<ll,ll> p2;
		ll z;
		for(i=1;i<=n-k+1;i++)
		{
			p1=v[i-1],p2=v[i+k-2];
			z=p2.first-p1.first;
			if(p1.second==1)
				z--;
			if(p2.second==1)
				z--;
			if(z>maxi)
			{
				maxi=z;
				y=i;
			}
		}
		cout<<maxi+1<<" "<<y<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		ll a[n+1]={0},i;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		std::vector<pair<ll,ll> > v;
		ll x=0;
		v.push_back(make_pair(x,0));
		v.push_back(make_pair(x,0));
		for(i=2;i<=n-1;i++)
		{
			if(a[i]>a[i-1]&&a[i]>a[i+1])
			{
				x++;
				v.push_back(make_pair(x,1));
			}
			else
			{
				v.push_back(make_pair(x,0));
			}
		}
		v.push_back(make_pair(x,0));
		ll maxi=0;
		ll y;
		pair<ll,ll> p1;
		pair<ll,ll> p2;
		ll z;
		for(i=1;i<=n-k+1;i++)
		{
			p1=v[i-1],p2=v[i+k-1];
			z=p2.first-p1.first;
			if(p1.second==1)
				z--;
			if(p2.second==1)
				z--;
			if(z>maxi)
			{
				maxi=z;
				y=i;
			}
		}
		cout<<maxi+1<<" "<<y<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		ll a[n+1]={0},i;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		//std::vector<pair<ll,ll> > v;
		ll x=0;
		//v.push_back(make_pair(x,0));
		//v.push_back(make_pair(x,0));
		ll b[n+1]={0};
		for(i=2;i<=n-1;i++)
		{
			if(a[i]>a[i-1]&&a[i]>a[i+1])
			{
				x++;
				b[i]=x;
			}
			else
			{
				b[i]=x;
			}
		}
		b[n]=x;
		//v.push_back(make_pair(x,0));
		ll maxi=0;
		ll y;
		/*pair<ll,ll> p1;
		pair<ll,ll> p2;*/
		ll z,p,q;
		for(i=1;i<=n-k+1;i++)
		{
			p=i,q=i+k-1;
			z=b[q]-b[p-1];
			if(b[p]>b[p-1])
				z--;
			if(b[q]>b[q-1])
				z--;
			if(z>maxi)
			{
				maxi=z;
				y=i;
			}
		}
		//v.clear();
		cout<<maxi+1<<" "<<y<<"\n";
	}
}


#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
vector<pair<ll,ll>> u;
ll t,o,n,k,a[200000],f[200000],i,p,m,l;
int main()
{
	cin >> t;
	for ( o = 0 ; o < t ; o++ )
	{
		cin >> n >> k;
		m = 0;
		fill(f,f+n,0);
		for ( i = 0 ; i < n ; i++ ) cin >> a[i];
		for ( i = 1 ; i < n-1 ; i++ )
		{
			if ( a[i] > a[i-1] && a[i] > a[i+1] ) f[i] = f[i-1]+1;
			else f[i] = f[i-1];
		}
		f[n-1] = f[n-2];
		for ( i = 0 ; i <= n-k ; i++ )
		{
			p = f[i+k-2]-f[i];
			if ( p > m )
			{
				m = p;
				l = i+1;
			}
		}
		if ( l == 0 ) l = 1;
		cout << m+1 << " " << l << endl;
		u.clear();
	}
}


#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
ll t,o,n,k,a[200020],f[200020],i,p,m,l;
int main()
{
	cin >> t;
	for ( o = 0 ; o < t ; o++ )
	{
		cin >> n >> k;
		m = 0; l = 0;
		fill(f,f+n,0);
		for ( i = 1 ; i <= n ; i++ ) cin >> a[i];
		for ( i = 2 ; i < n ; i++ )
		{
			if ( a[i] > a[i-1] && a[i] > a[i+1] ) f[i] = f[i-1]+1;
			else f[i] = f[i-1];
		}
		f[n] = f[n-1];
		for ( i = 1 ; i <= n-k+1 ; i++ )
		{
			p = f[i+k-2]-f[i];
			if ( p > m )
			{
				m = p;
				l = i;
			}
		}
		if ( l == 0 ) l = 1;
		cout << m+1 << " " << l << endl;
	}
}


#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
vector<pair<ll,ll>> u;
ll t,o,n,k,a[200000],f[200000],i,p,m,l;
int main()
{
	cin >> t;
	for ( o = 0 ; o < t ; o++ )
	{
		cin >> n >> k;
		m = 0;
		fill(f,f+n,0);
		for ( i = 1 ; i <= n ; i++ ) cin >> a[i];
		for ( i = 2 ; i < n ; i++ )
		{
			if ( a[i] > a[i-1] && a[i] > a[i+1] ) f[i] = f[i-1]+1;
			else f[i] = f[i-1];
		}
		f[n] = f[n-1];
		for ( i = 1 ; i <= n-k+1 ; i++ )
		{
			p = f[i+k-2]-f[i];
			if ( p > m )
			{
				m = p;
				l = i;
			}
		}
		if ( l == 0 ) l = 1;
		cout << m+1 << " " << l << endl;
		u.clear();
	}
}


#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
ll t,o,n,k,a[200000],f[200000],i,p,m,l;
int main()
{
	cin >> t;
	for ( o = 0 ; o < t ; o++ )
	{
		cin >> n >> k;
		m = 0;
		fill(f,f+n,0);
		for ( i = 1 ; i <= n ; i++ ) cin >> a[i];
		for ( i = 2 ; i < n ; i++ )
		{
			if ( a[i] > a[i-1] && a[i] > a[i+1] ) f[i] = f[i-1]+1;
			else f[i] = f[i-1];
		}
		f[n] = f[n-1];
		for ( i = 1 ; i <= n-k+1 ; i++ )
		{
			p = f[i+k-2]-f[i];
			if ( p > m )
			{
				m = p;
				l = i;
			}
		}
		if ( l == 0 ) l = 1;
		cout << m+1 << " " << l << endl;
	}
}


#include <bits/stdc++.h>
using namespace std;
long a[200000],t,i,n,k,f[200000],m,o,j,g,p;
long peak(long h)
{
	if ( h == 0 || h == n-1 ) return 0;
	if ( a[h] > a[h-1] && a[h] > a[h+1] ) return 1;
	else return 0;
}
int main()
{
	cin >> t;
	for ( i = 0 ; i < t ; i++ )
	{
		cin >> n >> k; m = 0; o = 0;
		for ( j = 0 ; j < n ; j++ ) cin >> a[j];
		for ( j = 0 ; j < n ; j++ )
		{
			if ( j == 0 ) for ( g = 1 ; g <= k-2 ; g++ ) m+=peak(g);
			else
			{
				p = p-peak(j)+peak(j+k-2);
				if ( p > m )
				{
					m = p;
					o = j+1;
				}
			}
			//cout << m << " ";
		}
		cout << m+1 << " " << o+1 << endl;
	}
}


#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
vector<pair<ll,ll>> u;
ll t,o,n,k,a[200000],f[200000],i,p,m,l;
int main()
{
	cin >> t;
	for ( o = 0 ; o < t ; o++ )
	{
		cin >> n >> k;
		m = 0;
		fill(f,f+n,0);
		for ( i = 0 ; i < n ; i++ ) cin >> a[i];
		for ( i = 1 ; i < n-1 ; i++ )
		{
			if ( a[i] > a[i-1] && a[i] > a[i+1] ) f[i] = f[i-1]+1;
			else f[i] = f[i-1];
		}
		f[n-1] = f[n-2];
		for ( i = 0 ; i < n ; i++ ) cout << f[i] << " ";
		cout << endl;
		for ( i = 0 ; i <= n-k ; i++ )
		{
			p = f[i+k-2]-f[i];
			if ( p > m )
			{
				m = p;
				l = i+1;
			}
		}
		cout << m+1 << " " << l << endl;
		cout << endl;
		u.clear();
	}
}


#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
vector<pair<ll,ll>> u;
ll t,o,n,k,a[200000],f[200000],i,p,m,l;
int main()
{
	cin >> t;
	for ( o = 0 ; o < t ; o++ )
	{
		cin >> n >> k;
		m = 0;
		fill(f,f+n,0);
		for ( i = 0 ; i < n ; i++ ) cin >> a[i];
		for ( i = 1 ; i < n-1 ; i++ )
		{
			if ( a[i] > a[i-1] && a[i] > a[i+1] ) f[i] = f[i-1]+1;
			else f[i] = f[i-1];
		}
		f[n-1] = f[n-2];
		for ( i = 0 ; i <= n-k ; i++ )
		{
			p = f[i+k-2]-f[i];
			if ( p > m )
			{
				m = p;
				l = i+1;
			}
		}
		cout << m+1 << " " << l << endl;
		u.clear();
	}
}


#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
ll t,o,n,k,a[200000],f[200000],i,p,m,l;
int main()
{
	cin >> t;
	for ( o = 0 ; o < t ; o++ )
	{
		cin >> n >> k;
		m = 0; l = 0;
		fill(f,f+n,0);
		for ( i = 1 ; i <= n ; i++ ) cin >> a[i];
		for ( i = 2 ; i < n ; i++ )
		{
			if ( a[i] > a[i-1] && a[i] > a[i+1] ) f[i] = f[i-1]+1;
			else f[i] = f[i-1];
		}
		f[n] = f[n-1];
		for ( i = 1 ; i <= n-k+1 ; i++ )
		{
			p = f[i+k-2]-f[i];
			if ( p > m )
			{
				m = p;
				l = i;
			}
		}
		if ( l == 0 ) l = 1;
		cout << m+1 << " " << l << endl;
	}
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
#define log2(X) (63ll - __builtin_clzll(X))

ll po(ll a, ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)
        {
            res=((res)%mod*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return res%mod;
}

int main()
{
    fast()
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll arr[n+1];
        for(int i=1; i<=n; i++)
        {
            cin>>arr[i];
        }
        ll ans[n+1]={0};
        ll c=0;
        ans[1]=0;
        int index[n+1]={0};
        for(int i=2; i<=n-1; i++)
        {
            if(arr[i]>arr[i-1] && arr[i]>arr[i+1])
            {
                c++;
                index[i]=1;
            }
            ans[i]=c;
        }

        ans[n]=c;
        ll ma=0,in=0;
        for(int i=1; i<=n-k+1; i++)
        {
            if(ans[i+k-1]-ans[i]>ma && index[i]!=1 && index[i+k-1]!=1)
            {
                ma=ans[i+k-1]-ans[i];
                in=i;
            }
        }
        if(in==0){
        cout<<1<<" "<<1<<"\n";}

        else cout<<ma+1<<" "<<in<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
#define log2(X) (63ll - __builtin_clzll(X))

ll po(ll a, ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)
        {
            res=((res)%mod*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return res%mod;
}

int main()
{
    fast()
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll arr[n+1];
        for(int i=1; i<=n; i++)
        {
            cin>>arr[i];
        }
        ll ans[n+1]={0};
        ll c=0;
        ans[1]=0;
        int index[n+1]={0};
        for(int i=2; i<=n-1; i++)
        {
            if(arr[i]>arr[i-1] && arr[i]>arr[i+1])
            {
                c++;
                index[i]=1;
            }
            ans[i]=c;
        }

        ans[n]=c;
        ll ma=0,in=0;
        for(int i=1; i<=n-k+1; i++)
        {
            if(ans[i+k-1]-ans[i]>ma && index[i]!=1 && index[i+k-1]!=1)
            {
                ma=ans[i+k-1]-ans[i];
                in=i;
            }
        }
        cout<<ma+1<<" "<<in<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
#define log2(X) (63ll - __builtin_clzll(X))

ll po(ll a, ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)
        {
            res=((res)%mod*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return res%mod;
}

int main()
{
    fast()
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll arr[n+1];
        for(int i=1; i<=n; i++)
        {
            cin>>arr[i];
        }
        ll ans[n+1]={0};
        ll c=0;
        ans[1]=0;
        int index[n+1]={0};
        for(int i=2; i<=n-1; i++)
        {
            if(arr[i]>arr[i-1] && arr[i]>arr[i+1])
            {
                c++;
                index[i]=1;
            }
            ans[i]=c;
        }

        ans[n]=c;
        ll ma=0,in=0;
        for(int i=1; i<=n-k+1; i++)
        {
            ll v=ans[i+k-1]-ans[i];
            if(index[i]==1)
            {
              continue;
            }
            if(index[i+k-1]==1)
            {
                continue;
            }
            if(v>ma)
            {
                ma=v;
                in=i;
            }
        }
        if(in==0){
        cout<<1<<" "<<1<<"\n";}
        else
        {
            cout<<ma+1<<" "<<in<<"\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
#define log2(X) (63ll - __builtin_clzll(X))

ll po(ll a, ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)
        {
            res=((res)%mod*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return res%mod;
}

int main()
{
    fast()
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll arr[n+1];
        for(int i=1; i<=n; i++)
        {
            cin>>arr[i];
        }
        ll ans[n+1]={0};
        ll c=0;
        ans[1]=0;
        int index[n+1]={0};
        for(int i=2; i<=n-1; i++)
        {
            if(arr[i]>arr[i-1] && arr[i]>arr[i+1])
            {
                c++;
                index[i]=1;
            }
            ans[i]=c;
        }

        ans[n]=c;
        ll ma=0,in=0;
        for(int i=1; i<=n-k+1; i++)
        {
            if(ans[i+k-1]-ans[i]>ma && index[i]!=1 && index[i+k-1]!=1)
            {
               if(ans[i-1]<ans[i])
               {
                   ma=ans[i+k-1]-ans[i]+1;
                   in=i;
               }
               else
               {
                   ma=ans[i+k-1]-ans[i];
                   in=i;
               }
            }
        }
        cout<<ma+1<<" "<<in<<"\n";
    }
    return 0;
}