#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
const int MOD = 1000000007;
const int MOD1 = 1000000009;
long long int spf[N], fact[N], inv[N];
long long int modularExponentiation(long long int x, long long int n) {
  int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % MOD;
    x = (x * x) % MOD;
    n = n / 2;
  }
  return result;
}
void pre() {
  fact[0] = 1;
  inv[0] = 1;
  for (long long int i = 1; i < N; i++) spf[i] = i;
  for (long long int i = 2; i < N; i++) {
    if (spf[i] == i) {
      for (long long int j = i + i; j < N; j += i) spf[j] = min(spf[j], i);
    }
  }
  for (long long int i = 1; i < N; i++) {
    fact[i] = (fact[i - 1] * i) % MOD;
    inv[i] = modularExponentiation(fact[i], MOD - 2);
  }
}
long long int ncr(long long int n, long long int k) {
  long long int ans = fact[n];
  ans = (ans * inv[n - k]) % MOD;
  ans = (ans * inv[k]) % MOD;
  return ans;
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  long long int temp = n;
  map<long long int, long long int> y;
  while (temp > 1) {
    y[spf[temp]]++;
    temp /= spf[temp];
  }
  long long int ans = 1;
  for (auto X : y) {
    ans = (ans * ncr(X.second + m - 1, m - 1)) % MOD;
  }
  ans = (ans * modularExponentiation(2, m - 1)) % MOD;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  pre();
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
