#include <bits/stdc++.h>
using namespace std;
int N, n, K, mod, inv[100009], fac[100009], put[100009];
long double PI = acos(-1.0);
bool DBG;
struct comp {
  double a, b;
  long long get_val() { return (long long)((double)a + 0.5); }
  comp() : a(0.0), b(0.0) {}
  comp(int N) { a = cos((double)2.0 * PI / N), b = -sin((double)2.0 * PI / N); }
  comp(double x) : a(x), b(0.0) {}
  comp(double _a, double _b) : a(_a), b(_b) {}
};
comp operator+(comp c1, comp c2) { return comp(c1.a + c2.a, c1.b + c2.b); }
comp operator*(comp c1, comp c2) {
  return comp(c1.a * c2.a - c1.b * c2.b, c1.a * c2.b + c1.b * c2.a);
}
comp operator-(comp c1, comp c2) { return comp(c1.a - c2.a, c1.b - c2.b); }
comp operator-(comp c) { return comp(-c.a, -c.b); }
void init(comp *A) { A = new comp[N + 1]; }
comp A[3][100009], B[3][100009], C[100009], D[100009], E[100009], ans[100009],
    dp[100009], aux[100009], aux2[100009];
void DFT(comp *A, int step, int N, comp *B) {
  if (N == 1) {
    *B = *A;
    return;
  }
  DFT(A, step << 1, N >> 1, B), DFT(A + step, step << 1, N >> 1, B + (N >> 1));
  comp omega = comp(N), put = comp((double)1.0);
  for (int i = 0; i < N >> 1; i++) {
    comp t1 = B[i], t2 = B[i + (N >> 1)];
    B[i] = t1 + t2 * put;
    B[i + (N >> 1)] = t1 - t2 * put;
    put = put * omega;
  }
}
void InverseDFT(comp *A, int N, comp *B) {
  DFT(A, 1, N, B);
  for (int i = 0; i < N; i++) B[i] = B[i] * ((double)1.0 / N);
  reverse(B + 1, B + N);
}
void Print(comp *A, int N) {
  for (int i = 0; i < N; i++) printf("%d ", (int)A[i].get_val());
  printf("\n");
}
void Exact_Print(comp *A, int N) {
  for (int i = 0; i < N; i++) printf("(%.5f, %.5f) ", A[i].a, A[i].b);
  printf("\n");
}
void Init() {
  N = 1;
  while (N < K + 1) N += N;
  N += N;
}
void Get_Product(comp *A, comp *B) {
  DFT(A, 1, N, C), DFT(B, 1, N, D);
  for (int i = 0; i < N; i++) E[i] = C[i] * D[i];
  InverseDFT(E, N, ans);
}
void Cop(comp *A, comp *B) {
  for (int i = 0; i < N; i++) A[i] = B[i];
}
int pow(int a, int b) {
  int p = 1;
  for (int i = 0; (1 << i) <= b; i++) {
    if (b & (1 << i)) p = (1LL * p * a) % mod;
    a = (1LL * a * a) % mod;
  }
  return p;
}
void Multiply(comp *a, comp *b, comp *C, int l) {
  int v1[100009], v2[100009], fin_ans[100009];
  for (int i = 0; i < N; i++) {
    long long curr = a[i].get_val();
    int coef = (1LL * inv[i] * pow(2, i * l)) % mod;
    v1[i] = (1LL * curr * coef) % mod;
    curr = b[i].get_val();
    v2[i] = (1LL * curr * inv[i]) % mod, fin_ans[i] = 0;
  }
  if (DBG) {
    for (int i = 0; i < N; i++) printf("%d ", v1[i]);
    printf("\n*\n");
    for (int j = 0; j < N; j++) printf("%d ", v2[j]);
    printf("\n");
  }
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < N; j++)
      A[i][j] = comp((double)(v1[j] % 1000)), v1[j] /= 1000,
      B[i][j] = comp((double)(v2[j] % 1000)), v2[j] /= 1000;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) {
      Get_Product(A[i], B[j]);
      int coef = 1, auxx = i + j;
      while (auxx--) coef = (1LL * coef * 1000) % mod;
      for (int k = 0; k < N; k++)
        fin_ans[k] =
            ((long long)fin_ans[k] + 1LL * coef * ans[k].get_val()) % mod;
    }
  for (int i = 0; i < N; i++) {
    fin_ans[i] = (1LL * fin_ans[i] * fac[i]) % mod;
    C[i] = comp((double)fin_ans[i]);
  }
}
int comb(int N, int K) {
  int ans = (1LL * fac[N] * inv[K]) % mod;
  ans = (1LL * ans * inv[N - K]) % mod;
  return ans;
}
int main() {
  scanf("%d %d", &n, &K), mod = 1e9 + 7;
  if (n > K) {
    printf("0\n");
    return 0;
  }
  fac[0] = 1, inv[0] = 1;
  for (int i = 1; i <= K; i++)
    fac[i] = (1LL * fac[i - 1] * i) % mod, inv[i] = pow(fac[i], mod - 2);
  Init();
  for (int i = 1; i <= K; i++) aux[i] = comp((double)1);
  if (n & 1)
    Cop(dp, aux);
  else
    dp[0] = comp(1);
  for (int i = 1; (1 << i) <= n; i++) {
    Cop(aux2, aux);
    Multiply(aux, aux2, aux, (1 << (i - 1)));
    if (n & (1 << i)) Multiply(dp, aux, dp, (1 << i));
  }
  int cnt = 0;
  for (int i = 1; i <= K; i++) {
    long long curr = dp[i].get_val() % mod;
    cnt = ((long long)cnt + 1LL * curr * comb(K, i)) % mod;
  }
  printf("%d\n", cnt);
  return 0;
}
