#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000;
const int MOD = 1000000007;
int a[20][1000001];
int f[1000001];
int cnt(int n, int m) {
  if (m == 1) return 1;
  if (n == 0) return 1;
  if (n == 1) return m;
  if (a[n][m]) return a[n][m];
  int ans = 0;
  for (int i = 0; i <= n; i++) ans = (ans + cnt(i, m - 1)) % MOD;
  return a[n][m] = ans;
}
int prime[MAXN + 1];
void getPrime() {
  memset(prime, 0, sizeof(prime));
  for (int i = 2; i <= MAXN; i++) {
    if (!prime[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0] && prime[j] <= MAXN / i; j++) {
      prime[prime[j] * i] = 1;
      if (i % prime[j] == 0) break;
    }
  }
}
int factor[100][2];
int fatCnt;
int getFactors(int x) {
  fatCnt = 0;
  int tmp = x;
  for (int i = 1; prime[i] <= tmp / prime[i]; i++) {
    factor[fatCnt][1] = 0;
    if (tmp % prime[i] == 0) {
      factor[fatCnt][0] = prime[i];
      while (tmp % prime[i] == 0) {
        factor[fatCnt][1]++;
        tmp /= prime[i];
      }
      fatCnt++;
    }
  }
  if (tmp != 1) {
    factor[fatCnt][0] = tmp;
    factor[fatCnt++][1] = 1;
  }
  return fatCnt;
}
int main() {
  getPrime();
  int q;
  scanf("%d", &q);
  f[1] = 1;
  for (int i = 2; i <= 1000000; i++) f[i] = f[i - 1] * 2 % MOD;
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    getFactors(a);
    int ans = 1;
    for (int i = 0; i < fatCnt; i++) {
      ans = (long long)ans * cnt(factor[i][1], b) % MOD;
    }
    printf("%d\n", (long long)ans * f[b] % MOD);
  }
  return 0;
}
