#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 401000;
const long long mod = 1000000007;
const double PI = acos(-1);
int n, m, len, lg, rev[MAXN + 5], fac[MAXN + 5], ifac[MAXN + 5], pwr[MAXN + 5];
int F[MAXN + 5], ans[MAXN + 5];
struct Complex {
  double x, y;
  Complex() {}
  Complex(const double tx, const double ty) : x(tx), y(ty) {}
  inline Complex operator+(const Complex t) const {
    return Complex(x + t.x, y + t.y);
  }
  inline Complex operator-(const Complex t) const {
    return Complex(x - t.x, y - t.y);
  }
  inline Complex operator*(const Complex t) const {
    return Complex(x * t.x - y * t.y, x * t.y + y * t.x);
  }
  inline Complex operator/(const double t) const {
    return Complex(x / t, y / t);
  }
} dxs[MAXN + 5];
inline void FFT(const int n, Complex* A, const int tp) {
  for (int i = 0; i < n; ++i)
    if (i < rev[i]) swap(A[i], A[rev[i]]);
  for (int i = 2, stp = 1; i <= n; i <<= 1, stp <<= 1) {
    for (int j = 0; j < n; j += i) {
      for (int k = 0; k < stp; ++k) {
        Complex w(dxs[n / stp * k].x, tp * dxs[n / stp * k].y);
        Complex ev(A[j + k]), ov(w * A[j + k + stp]);
        A[j + k] = ev + ov, A[j + k + stp] = ev - ov;
      }
    }
  }
  if (!~tp)
    for (int i = 0; i < n; ++i) A[i] = A[i] / n;
}
inline void initFFT(const int lg) {
  int n = 1 << lg;
  for (int i = 0; i < n; ++i)
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << lg >> 1);
  for (int i = 1; i < n; i <<= 1) {
    for (int k = 0; k < i; ++k) {
      dxs[n / i * k] = Complex(cos(PI * k / i), sin(PI * k / i));
    }
  }
}
inline void polyConv(const int n, const int* A, const int* B, int* C) {
  static Complex highA[MAXN + 5], highB[MAXN + 5], lowA[MAXN + 5],
      lowB[MAXN + 5];
  for (int i = 0; i < n; ++i) {
    lowA[i].x = A[i] & 0x7fff, highA[i].x = A[i] >> 15;
    lowB[i].x = B[i] & 0x7fff, highB[i].x = B[i] >> 15;
    lowA[i].y = highA[i].y = lowB[i].y = highB[i].y = 0;
  }
  FFT(n, lowA, 1), FFT(n, highA, 1), FFT(n, lowB, 1), FFT(n, highB, 1);
  for (int i = 0; i < n; ++i) {
    Complex la(lowA[i]), ha(highA[i]), lb(lowB[i]), hb(highB[i]);
    lowA[i] = ha * hb, highA[i] = la * hb, lowB[i] = ha * lb,
    highB[i] = la * lb;
  }
  FFT(n, lowA, -1);
  FFT(n, highA, -1);
  FFT(n, lowB, -1);
  FFT(n, highB, -1);
  for (int i = 0; i < n; ++i) {
    C[i] = ((1ll << 30) % mod * ((long long)(round(lowA[i].x)) % mod) % mod +
            ((long long)(round(highA[i].x)) % mod << 15) % mod +
            ((long long)(round(lowB[i].x)) % mod << 15) % mod +
            ((long long)(round(highB[i].x)) % mod)) %
           mod;
  }
}
inline long long quick_power(long long a, long long b, long long mod) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  while (ret < 0) ret += mod;
  return ret % mod;
}
inline void init(const int n) {
  fac[0] = ifac[0] = pwr[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fac[i] = 1ll * i * fac[i - 1] % mod;
    pwr[i] = (pwr[i - 1] << 1) % mod;
  }
  ifac[n] = quick_power(fac[n], mod - 2, mod);
  for (int i = n - 1; i; --i) ifac[i] = (i + 1ll) * ifac[i + 1] % mod;
}
inline void add(const int fn, const int fm) {
  if (!fn) {
    for (int i = 0; i <= n; ++i) ans[i] = F[i];
    return;
  }
  static int A[MAXN + 5], B[MAXN + 5];
  for (int i = 0; i <= n; ++i) {
    A[i] = 1ll * ans[i] * ifac[i] % mod *
           quick_power(2, 1ll * i * fm % (mod - 1), mod) % mod;
    B[i] = 1ll * F[i] * ifac[i] % mod;
  }
  for (int i = n + 1; i < len; ++i) A[i] = B[i] = 0;
  polyConv(len, A, B, ans);
  for (int i = 0; i <= n; ++i) ans[i] = 1ll * ans[i] * fac[i] % mod;
  for (int i = n + 1; i < len; ++i) ans[i] = 0;
}
inline void shift(const int cur) {
  static int A[MAXN + 5], B[MAXN + 5];
  for (int i = 0; i <= n; ++i) {
    A[i] = 1ll * F[i] * ifac[i] % mod *
           quick_power(2, 1ll * i * cur % (mod - 1), mod) % mod;
    B[i] = 1ll * F[i] * ifac[i] % mod;
  }
  for (int i = n + 1; i < len; ++i) A[i] = B[i] = 0;
  polyConv(len, A, B, F);
  for (int i = 0; i <= n; ++i) F[i] = 1ll * F[i] * fac[i] % mod;
  for (int i = n + 1; i < len; ++i) F[i] = 0;
}
int main() {
  scanf("%d %d", &m, &n);
  if (m > n) return puts("0") * 0;
  len = 1;
  lg = 0;
  for (; len <= n << 1; len <<= 1, ++lg)
    ;
  initFFT(lg);
  init(n);
  for (int i = 1; i <= n; ++i) F[i] = 1;
  for (int i = 0, cur = 0; 1 << i <= m; ++i) {
    if ((m >> i) & 1) add(cur, 1 << i), cur |= 1 << i;
    shift(1 << i);
  }
  long long sum = 0;
  for (int i = 0; i <= n; ++i) {
    sum =
        (sum + 1ll * ans[i] * fac[n] % mod * ifac[i] % mod * ifac[n - i]) % mod;
  }
  printf("%lld\n", sum);
  return 0;
}
