#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 5;
const int MOD = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) (ch == '-') && (f = -f), ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
inline int expow(int n, int k) {
  int ans = 1;
  for (; k; k >>= 1, n = 1ll * n * n % MOD)
    (k & 1) && (ans = 1ll * n * ans % MOD);
  return ans;
}
int prime[MAXN], cnt;
bool isprime[MAXN];
int fac[MAXN], inv[MAXN], pw2[MAXN];
inline void sieve(int n = MAXN - 5) {
  register int i, j;
  for (i = 2; i <= n; ++i) isprime[i] = 1;
  for (i = 2; i <= n; ++i) {
    if (isprime[i]) prime[++cnt] = i;
    for (j = 1; j <= cnt && i * prime[j] <= n; ++j) {
      isprime[i * prime[j]] = 0;
      if (i % prime[j] == 0) break;
    }
  }
  for (fac[0] = i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % MOD;
  for (inv[i = n] = expow(fac[n], MOD - 2); i; --i)
    inv[i - 1] = 1ll * inv[i] * i % MOD;
  for (pw2[0] = i = 1; i <= n; ++i) pw2[i] = 2ll * pw2[i - 1] % MOD;
}
inline int C(int n, int m) {
  if (n < m) return 0;
  return 1ll * fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}
inline int F(int n, int m) { return C(n + m - 1, m - 1); }
int main() {
  register int i;
  sieve();
  for (int T = read(); T; --T) {
    int m = read(), n = read();
    int ans = pw2[n - 1];
    for (i = 1; 1ll * prime[i] * prime[i] <= m; ++i) {
      if (m % prime[i]) continue;
      int tot = 0;
      while (m % prime[i] == 0) m /= prime[i], ++tot;
      ans = 1ll * ans * F(tot, n) % MOD;
    }
    if (m != 1) ans = 1ll * ans * F(1, n) % MOD;
    printf("%d\n", ans);
  }
  return 0;
}
