#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
long long fac[maxn];
void init() {
  fac[0] = 1;
  for (int i = 1; i < maxn; i++) {
    fac[i] = fac[i - 1] * i % mod;
  }
}
long long pows(long long x, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return ans;
}
long long C(int n, int m) {
  if (m == 0 || n == 0) return 1;
  if (m * 2 > n) m = n - m;
  return fac[n] * pows(fac[n - m], mod - 2) % mod * pows(fac[m], mod - 2) % mod;
}
int main() {
  init();
  int cas = 0;
  scanf("%d", &cas);
  while (cas--) {
    int n, m;
    scanf("%d%d", &n, &m);
    long long ans = pows(2, m - 1);
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        int cnt = 0;
        while (n % i == 0) {
          cnt++;
          n /= i;
        }
        ans = ans * C(m + cnt - 1, cnt) % mod;
      }
    }
    if (n > 1) ans = ans * m % mod;
    printf("%I64d\n", ans);
  }
  return 0;
}
