Polycarp often uses his smartphone. He has already installed n applications on it. Application with number i takes up a_i units of memory.

Polycarp wants to free at least m units of memory (by removing some applications).

Of course, some applications are more important to Polycarp than others. He came up with the following scoring system — he assigned an integer b_i to each application: 

  * b_i = 1 — regular application; 
  * b_i = 2 — important application. 



According to this rating system, his phone has b_1 + b_2 + … + b_n convenience points.

Polycarp believes that if he removes applications with numbers i_1, i_2, …, i_k, then he will free a_{i_1} + a_{i_2} + … + a_{i_k} units of memory and lose b_{i_1} + b_{i_2} + … + b_{i_k} convenience points.

For example, if n=5, m=7, a=[5, 3, 2, 1, 4], b=[2, 1, 1, 2, 1], then Polycarp can uninstall the following application sets (not all options are listed below): 

  * applications with numbers 1, 4 and 5. In this case, it will free a_1+a_4+a_5=10 units of memory and lose b_1+b_4+b_5=5 convenience points; 
  * applications with numbers 1 and 3. In this case, it will free a_1+a_3=7 units of memory and lose b_1+b_3=3 convenience points. 
  * applications with numbers 2 and 5. In this case, it will free a_2+a_5=7 memory units and lose b_2+b_5=2 convenience points. 



Help Polycarp, choose a set of applications, such that if removing them will free at least m units of memory and lose the minimum number of convenience points, or indicate that such a set does not exist.

Input

The first line contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases. Then t test cases follow.

The first line of each test case contains two integers n and m (1 ≤ n ≤ 2 ⋅ 10^5, 1 ≤ m ≤ 10^9) — the number of applications on Polycarp's phone and the number of memory units to be freed.

The second line of each test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9) — the number of memory units used by applications.

The third line of each test case contains n integers b_1, b_2, …, b_n (1 ≤ b_i ≤ 2) — the convenience points of each application.

It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case, output on a separate line: 

  * -1, if there is no set of applications, removing which will free at least m units of memory; 
  * the minimum number of convenience points that Polycarp will lose if such a set exists. 

Example

Input


5
5 7
5 3 2 1 4
2 1 1 2 1
1 3
2
1
5 10
2 3 2 3 2
1 2 1 2 1
4 10
5 1 3 4
1 2 1 2
4 5
3 2 1 2
2 1 2 1


Output


2
-1
6
4
3

Note

In the first test case, it is optimal to remove applications with numbers 2 and 5, freeing 7 units of memory. b_2+b_5=2.

In the second test case, by removing the only application, Polycarp will be able to clear only 2 of memory units out of the 3 needed.

In the third test case, it is optimal to remove applications with numbers 1, 2, 3 and 4, freeing 10 units of memory. b_1+b_2+b_3+b_4=6.

In the fourth test case, it is optimal to remove applications with numbers 1, 3 and 4, freeing 12 units of memory. b_1+b_3+b_4=4.

In the fifth test case, it is optimal to remove applications with numbers 1 and 2, freeing 5 units of memory. b_1+b_2=3.
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <sched.h>
#include <set>
#include <stack>
#include <stdexcept>
#include <string>
#include <sys/types.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using st = std::size_t;
using bo = uint8_t;
using dbllims = std::numeric_limits<double>;
using ll = long long;

template <typename T>
std::ostream &operator<<(std::ostream &os, std::vector<T> vec) {
  if (!vec.empty()) {
    std::copy(vec.begin(), vec.end() - 1, std::ostream_iterator<T>(os, " "));
    os << vec.back();
  }
  return os;
}

int gcd(ll a, ll b) {
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}

auto reverse_num(ll x) -> ll {
  ll ret = 0;
  while (0 < x) {
    ret *= 10;
    ret += x % 10;
    x /= 10;
  }
  return ret;
}

auto nchoosek(ll n, ll k) -> ll {
  if (k > n) {
    return 0;
  }
  if (k * 2 > n) {
    k = n - k;
  }
  if (k == 0) {
    return 1;
  }
  ll result = n;
  for (ll i = 2; i <= k; ++i) {
    result *= (n - i + 1);
    result /= i;
  }
  return result;
}

template <typename T> class SizedDSU {
  std::unordered_map<T, T> parent;
  std::unordered_map<T, T> size_;

public:
  auto make_set(T t) -> void {
    parent[t] = t;
    size_[t] = 1;
  }

  auto find_set(T t) -> T {
    if (t == parent[t]) {
      return t;
    }
    return parent[t] = find_set(parent[t]);
  }

  auto union_sets(T a, T b) -> void {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
      if (size_[a] < size_[b]) {
        std::swap(a, b);
      }
      size_[a] += size_[b];
      parent[b] = a;
      size_[b] = 0;
    }
  }

  auto size(T t) -> T { return size_.at(find_set(t)); }
};

vector<ll> factors(ll n) {
  auto ret = std::vector<ll>{};
  ret.emplace_back(1);
  for (int d : {2, 3, 5}) {
    while (n % d == 0) {
      ret.emplace_back(d);
      n /= d;
    }
  }
  constexpr std::array<int, 8> const increments = {4, 2, 4, 2, 4, 6, 2, 6};
  int i{0};
  for (ll d{7}; d * d <= n; d += increments[i++]) {
    while (n % d == 0) {
      ret.emplace_back(d);
      n /= d;
    }
    i %= 8;
  }
  if (1 < n)
    ret.emplace_back(n);
  return ret;
}

void yn(bool v) { std::cout << (v ? "YES" : "NO") << "\n"; }

template <typename T> std::vector<T> vecn(int n) {
  auto v = std::vector<T>(n);
  for (auto &e : v) {
    cin >> e;
  }
  return v;
}

constexpr ll const INF{static_cast<ll>(10e15)};
constexpr ll const mod{1'000'000'000 + 7};

constexpr ll const N{200000};

// auto acnt = std::vector<int>(200001);
// auto bcnt = std::vector<int>(200001);
// auto edges = std::vector<pair<int, int>>(200001);

// auto solve_wrapper() -> void {
//   int a, b, k;
//   cin >> a >> b >> k;
//   fill(acnt.begin(), acnt.begin() + k, 0);
//   fill(bcnt.begin(), bcnt.begin() + k, 0);
//   int t;
//   for (int i{0}; i < k; ++i) {
//     cin >> t;
//     --t;
//     acnt[t]++;
//     edges[i].first = t;
//   }
//   for (int i{0}; i < k; ++i) {
//     cin >> t;
//     --t;
//     bcnt[t]++;
//     edges[i].second = t;
//   }
//   ll ans{0};
//   for (int i{0}; i < k; ++i) {
//     auto ae = edges[i].first;
//     auto be = edges[i].second;
//     ans += k - acnt[ae] - bcnt[be] + 1;
//   }
//   std::cout << ans / 2 << "\n";
// }

vector<ll> cumsum(std::vector<ll> const &v) {
  auto ret = std::vector<ll>(v.size() + 1);
  ret[0] = 0;
  if (v.empty()) {
    return ret;
  }
  ret[1] = v[0];
  for (st i{0}; i < v.size(); ++i) {
    ret[i + 1] = ret[i] + v[i];
  }
  return ret;
}

auto solve_wrapper() -> void {
  ll n, m;
  cin >> n >> m;
  auto cost1 = std::vector<ll>{};
  auto cost2 = std::vector<ll>{};
  auto v = std::vector<ll>(n);
  ll t{0};
  for (int i{0}; i < n; ++i) {
    ll a;
    cin >> a;
    t += a;
    v[i] = a;
  }
  for (int i{0}; i < n; ++i) {
    ll a;
    cin >> a;
    if (a == 1) {
      cost1.emplace_back(v[i]);
    } else {
      cost2.emplace_back(v[i]);
    }
  }
  if (t < m) {
    std::cout << "-1\n";
    return;
  }
  sort(cost1.begin(), cost1.end(), greater<>());
  sort(cost2.begin(), cost2.end(), greater<>());
  // std::cout << "h\n";
  auto cumsum1 = cumsum(cost1);
  auto cumsum2 = cumsum(cost2);
  ll best = t;
  for (int i{0}; i < (int)cumsum1.size(); ++i) {
    auto it = lower_bound(cumsum2.begin(), cumsum2.end(), m - cumsum1[i]);
    if (it != cumsum2.end()) {

      ll j = distance(cumsum2.begin(), it);
      best = min(best, i + j * 2);
    }
  }

  std::cout << best << "\n";
}

auto main() -> int {
  ll t = 1;
  std::cin >> t;
  // cout.precision(dbllims::max_digits10);
  while (t-- > 0) {
    solve_wrapper();
  }
  return 0;
}
