#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
const int mod = 1e9 + 7;
const long long M = sqrt(mod);
const long long MM = M * M;
const double pi = acos(-1.0);
long long n, k;
int rev[N];
long long pw[N], fac[N], fav[N], inv[N];
long long a[N], b[N], c[N], ans[N], dp[20][N];
struct Cpx {
  double x, y;
  Cpx(double _x = 0, double _y = 0) : x(_x), y(_y) {}
  Cpx operator+(Cpx &b) { return Cpx(x + b.x, y + b.y); }
  Cpx operator-(Cpx &b) { return Cpx(x - b.x, y - b.y); }
  Cpx operator*(Cpx &b) { return Cpx(x * b.x - y * b.y, x * b.y + y * b.x); }
} W[N];
long long C(int x, int y) {
  if (x < y) return 0;
  return fac[x] * fav[y] % mod * fav[x - y] % mod;
}
void init() {
  cin >> n >> k;
  if (n > k) {
    puts("0");
    exit(0);
  }
  fac[0] = fav[0] = 1;
  fac[1] = fav[1] = inv[1] = 1;
  for (int i = 2; i < N; ++i) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = -mod / i * inv[mod % i] % mod + mod;
    fav[i] = fav[i - 1] * inv[i] % mod;
  }
  pw[0] = 1;
  for (int i = 1; i < N; ++i) {
    pw[i] = pw[i - 1] * 2 % mod;
  }
}
void calrev(int lim, int l) {
  for (int i = 1; i < lim; ++i) {
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << l - 1);
  }
  double alp = 2 * pi / lim;
  for (int i = 0; i < lim; ++i) {
    W[i] = Cpx(cos(alp * i), sin(alp * i));
  }
}
void FFT(Cpx *a, int lim, int type) {
  for (int i = 0; i < lim; ++i) {
    if (i < rev[i]) {
      swap(a[i], a[rev[i]]);
    }
  }
  for (int len = 2; len <= lim; len <<= 1) {
    int t = lim / len, mid = len >> 1;
    for (int j = 0; j < lim; j += len) {
      for (int k = 0; k < mid; ++k) {
        Cpx x = a[j + k], y = a[j + k + mid] * W[t * k];
        a[j + k] = x + y;
        a[j + k + mid] = x - y;
      }
    }
  }
  if (type == -1) {
    for (int i = 0; i < lim; ++i) {
      a[i].x /= lim;
    }
  }
}
void Mul(long long *a, long long *b, long long *c, int n, int m) {
  static Cpx k1[N], k2[N], b1[N], b2[N];
  static Cpx E[N], F[N], G[N], H[N];
  int lim = 1, l = 0;
  while (lim <= n + m + 2) {
    lim <<= 1;
    ++l;
  }
  for (int i = n + 1; i < lim; ++i) {
    a[i] = 0;
  }
  for (int i = m + 1; i < lim; ++i) {
    b[i] = 0;
  }
  for (int i = 0; i < lim; ++i) {
    k1[i] = Cpx(a[i] / M, 0);
    b1[i] = Cpx(a[i] % M, 0);
    k2[i] = Cpx(b[i] / M, 0);
    b2[i] = Cpx(b[i] % M, 0);
  }
  calrev(lim, l);
  FFT(k1, lim, 1);
  FFT(k2, lim, 1);
  FFT(b1, lim, 1);
  FFT(b2, lim, 1);
  for (int i = 0; i < lim; ++i) {
    E[i] = k1[i] * k2[i];
    F[i] = k1[i] * b2[i];
    G[i] = b1[i] * k2[i];
    H[i] = b1[i] * b2[i];
  }
  for (int i = 0; i < lim; ++i) {
    W[i].y = -W[i].y;
  }
  FFT(E, lim, -1);
  FFT(F, lim, -1);
  FFT(G, lim, -1);
  FFT(H, lim, -1);
  for (int i = 0; i < lim; ++i) {
    c[i] = 0;
    c[i] += (long long)(E[i].x + 0.5) % mod * MM;
    c[i] += (long long)(F[i].x + 0.5) % mod * M;
    c[i] += (long long)(G[i].x + 0.5) % mod * M;
    c[i] += (long long)(H[i].x + 0.5);
    c[i] %= mod;
  }
  for (int i = 0; i < lim; ++i) {
    W[i].y = -W[i].y;
  }
}
void trans(long long *A, long long *B, long long *C, int x, int y) {
  long long c = pw[y], t = 1;
  for (int j = 0; j <= k; ++j) {
    a[j] = A[j] * t % mod * fav[j] % mod;
    b[j] = B[j] * fav[j] % mod;
    t = t * c % mod;
  }
  Mul(a, b, C, k, k);
  for (int j = 0; j <= k; ++j) {
    C[j] = C[j] * fac[j] % mod;
  }
}
void Solve() {
  dp[0][0] = 0;
  for (int i = 1; i <= k; ++i) {
    dp[0][i] = 1;
  }
  for (int i = 1, l = 2; l <= n; ++i, l <<= 1) {
    trans(dp[i - 1], dp[i - 1], dp[i], l >> 1, l >> 1);
  }
  for (int i = 0; i <= k; ++i) {
    ans[i] = dp[0][i];
  }
  --n;
  int tmp = 1;
  for (int i = 0; i < 20; ++i) {
    if (n >> i & 1) {
      trans(ans, dp[i], ans, tmp, 1 << i);
      tmp += 1 << i;
    }
  }
  long long res = 0;
  for (int i = 0; i <= k; ++i) {
    res = (res + ans[i] * C(k, i)) % mod;
  }
  cout << res << endl;
}
int main() {
  init();
  Solve();
  return 0;
}
