#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long MOD = 1e6 + 3;
const long long pMOD = 1e6 + 2;
const int maxn = 1e6 + 10;
const int maxv = 1e3 + 10;
const double eps = 1e-9;
long long Pow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return ret;
}
long long mul(long long a, long long b) {
  long long ret = 0;
  while (b) {
    if (b & 1) ret = (ret + a) % pMOD;
    a = (a + a) % pMOD;
    b >>= 1;
  }
  return ret;
}
long long vis[100];
int main() {
  long long n, k;
  scanf("%lld%lld", &n, &k);
  if (n < 63 && (1LL << n) < k) {
    puts("1 1");
    return 0;
  }
  long long di = mul(k - 1, n);
  for (long long u = 62; u; u--) {
    long long d = 1LL << u;
    vis[u] = ((k - 1) / d) % pMOD;
    for (long long j = u + 1; j <= 62; j++)
      vis[u] = (vis[u] - vis[j] + pMOD) % pMOD;
    di = (di - vis[u] * u % pMOD + pMOD) % pMOD;
  }
  long long res = Pow(2, di);
  if (k > MOD) {
    printf("%lld %lld\n", res, res);
    return 0;
  }
  long long up = 1;
  for (long long i = 1; i < k; i++) {
    long long tmp = i;
    long long cnt = 0;
    while (tmp % 2 == 0) {
      cnt++;
      tmp /= 2;
    }
    up = (Pow(2, n - cnt) - tmp + MOD) % MOD * up % MOD;
  }
  up = (res - up + MOD) % MOD;
  printf("%lld %lld\n", up, res);
  return 0;
}
