#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long N = 2e6 + 5;
using ull = unsigned long long;
using namespace std;
long long n, m, t, k, T, ans, a[N], b[N], c[N], tong, h[N], d[N], u, v;
vector<long long> kq, adj[N];
pair<long long, long long> p[N];
struct dang {
  long long x, y, w;
} e[N];
bool cmp(const dang& u, const dang& v) { return u.w < v.w; }
long long pw(long long k, long long n) {
  long long total = 1;
  for (; n; n >>= 1) {
    if (n & 1) total = (total * k) % mod;
    k = (k * k) % mod;
  }
  return total;
}
long long cal(long long u, long long v) {
  if (u > v) return 0;
  return b[v] * c[u] % mod * c[v - u] % mod;
}
void cf() {
  m = 1e6 + 2;
  c[0] = b[0] = d[0] = 1;
  for (long long i = 1; i <= 2 * m; i++) {
    b[i] = (b[i - 1] * i) % mod;
    c[i] = pw(i, mod - 2);
    c[i] = c[i - 1] * c[i] % mod;
    d[i] = (d[i - 1] * 2) % mod;
  }
  cin >> t;
  for (long long i = 2; i <= m; i++) {
    if (a[i] == 0) {
      for (long long j = i; j <= m; j += i) a[j] = i;
    }
  }
  while (t-- > 0) {
    cin >> n >> m;
    ans = d[m - 1];
    while (n > 1) {
      k = a[n];
      long long cnt = 0;
      while (n % k == 0) {
        ++cnt;
        n /= k;
      }
      ans = (ans * cal(m - 1, cnt + m - 1)) % mod;
    }
    cout << ans << '\n';
  }
}
int main() {
  if (fopen("pieaters"
            ".in",
            "r")) {
    freopen(
        "pieaters"
        ".in",
        "r", stdin);
    freopen(
        "pieaters"
        ".out",
        "w", stdout);
  }
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int ntest;
  ntest = 1;
  while (ntest-- > 0) cf();
}
