#include <bits/stdc++.h>
using namespace std;
const int maxN = 1 << 18, M = 1 << 15, mod = 1e9 + 7;
const long double pi = acos(-1.0);
struct Complex {
  long double x, y;
  Complex(long double X = 0, long double Y = 0) {
    x = X;
    y = Y;
  }
};
Complex operator+(Complex a, Complex b) {
  return Complex(a.x + b.x, a.y + b.y);
}
Complex operator-(Complex a, Complex b) {
  return Complex(a.x - b.x, a.y - b.y);
}
Complex operator*(Complex a, Complex b) {
  return Complex(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}
Complex operator/(Complex a, long double p) {
  return Complex(a.x / p, a.y / p);
}
int m;
int lim, r[maxN + 1];
int fac[maxN + 1], inv[maxN + 1];
int stk[maxN + 1], top;
int ans[maxN + 1], na[maxN + 1];
long long n;
Complex A0[maxN + 1], A1[maxN + 1], B[maxN + 1];
Complex wn[maxN + 1];
inline int mpow(int a, int x) {
  int ans = 1;
  while (x) {
    if (x & 1) ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
    x >>= 1;
  }
  return ans;
}
inline void pre() {
  fac[0] = 1;
  for (int i = 1; i <= m; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  inv[m] = mpow(fac[m], mod - 2);
  for (int i = m - 1; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
  int cnt = 0;
  lim = 1;
  while (lim <= (m << 1)) lim <<= 1, cnt++;
  for (int i = 0; i < lim; i++) r[i] = (r[i >> 1] >> 1) | ((i & 1) << cnt - 1);
  for (int mid = 1; mid < lim; mid <<= 1) {
    Complex W(std::cos(pi / mid), std::sin(pi / mid));
    wn[mid] = Complex(1, 0);
    for (int j = 1; j < mid; j++) wn[mid + j] = wn[mid + j - 1] * W;
  }
}
inline void FFT(Complex *a, int type) {
  for (int i = 0; i < lim; i++)
    if (i < r[i]) swap(a[i], a[r[i]]);
  for (int mid = 1; mid < lim; mid <<= 1)
    for (int i = 0; i < lim; i += (mid << 1))
      for (int j = 0; j < mid; j++) {
        Complex x = a[i + j], y = a[i + mid + j] * wn[mid + j];
        a[i + j] = x + y;
        a[i + mid + j] = x - y;
      }
  if (type == -1) {
    for (int i = 0; i < lim; i++) a[i] = a[i] / lim;
    reverse(a + 1, a + lim);
  }
}
inline void Mul() {
  for (int i = 0; i <= m; i++) {
    A0[i].x = A1[i].x = ans[i] / M;
    A0[i].y = ans[i] % M;
    A1[i].y = -ans[i] % M;
    B[i].x = na[i] / M, B[i].y = na[i] % M;
  }
  FFT(A0, 1);
  FFT(A1, 1);
  FFT(B, 1);
  for (int i = 0; i < lim; i++) A0[i] = A0[i] * B[i], A1[i] = A1[i] * B[i];
  FFT(A0, -1);
  FFT(A1, -1);
  for (int i = 0; i <= m; i++) {
    long long res = 0;
    res += (long long)((A0[i].x + A1[i].x) / 2 + 0.5) % mod * M % mod * M % mod;
    res += (long long)(A0[i].y + 0.5) % mod * M % mod;
    res += (long long)((A1[i].x - A0[i].x) / 2 + 0.5) % mod;
    res = (res % mod + mod) % mod;
    ans[i] = res;
  }
  for (int i = 0; i < lim; i++) A0[i] = A1[i] = B[i] = Complex(0, 0);
}
inline void solve() {
  int tn = n - 1;
  while (tn) stk[++top] = tn, tn = (tn - 1) >> 1;
  for (int i = 1; i <= m; i++) ans[i] = inv[i];
  while (top) {
    int n = stk[top--];
    na[0] = 0;
    for (int i = 1, v = mpow(2, (n - 1) / 2 + 1), t = v; i <= m;
         i++, t = 1ll * t * v % mod)
      na[i] = 1ll * ans[i] * t % mod;
    Mul();
    if (!(n & 1)) {
      na[0] = 0;
      for (int i = 1, v = mpow(2, n), t = v; i <= m; i++, t = 1ll * t * v % mod)
        na[i] = 1ll * t * inv[i] % mod;
      Mul();
    }
  }
}
int main() {
  scanf("%lld %d", &n, &m);
  if (n > m) return puts("0"), 0;
  pre();
  solve();
  int res = 0;
  for (int i = n; i <= m; i++)
    res = (res + 1ll * inv[m - i] * ans[i] % mod) % mod;
  res = 1ll * res * fac[m] % mod;
  printf("%d\n", res);
  return 0;
}
