#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int N = 1e6 + 166;
ll f[N], lp[N], inv[N];
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
ll C(int n, int k) {
  ll res = (f[n] * inv[k]) % mod;
  return (res * inv[n - k]) % mod;
}
void solve() {
  int x, y;
  cin >> x >> y;
  if (y == 1) {
    cout << 1;
    return;
  }
  ll ans = 1;
  while (x > 1) {
    int cnt = 0, now = lp[x];
    assert(now >= 2 && x % now == 0);
    while (x % now == 0) {
      x /= now;
      ++cnt;
    }
    assert(cnt);
    ans *= C(y + cnt - 1, y - 1);
    ans %= mod;
  }
  cout << (ans * binpow(2, y - 1)) % mod;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int tt = 1;
  cin >> tt;
  for (int i = 2; i < N; ++i) {
    if (!lp[i]) {
      lp[i] = i;
      if (i * 1ll * i >= N) continue;
      for (int j = i * 1ll * i; j < N; j += i) {
        if (!lp[j]) lp[j] = i;
      }
    }
  }
  f[0] = 1;
  for (int i = 1; i < N; ++i) f[i] = f[i - 1] * i % mod;
  for (int i = 0; i < N; ++i) inv[i] = binpow(f[i], mod - 2);
  while (tt--) {
    solve();
    cout << "\n";
  }
}
