#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7, p = 1e9 + 7;
const long double pi = acos(-1.0);
int n, m, k, lim, f[N], rev[N], fac[N], ifac[N];
struct comple {
  long double a, b;
  comple(long double x = 0, long double y = 0) { a = x, b = y; }
} ansa[N], ansb[N], ansc[N], ansd[N], anse[N], ansf[N], ansg[N];
comple operator+(comple a, comple b) { return comple(a.a + b.a, a.b + b.b); }
comple operator-(comple a, comple b) { return comple(a.a - b.a, a.b - b.b); }
comple operator*(comple a, comple b) {
  return comple(a.a * b.a - a.b * b.b, a.a * b.b + a.b * b.a);
}
inline long long pows(long long u, int v) {
  long long ans = 1;
  while (v > 0) {
    if (v & 1) ans = ans * u % p;
    u = u * u % p, v = v >> 1;
  }
  return ans;
}
inline void FFT(comple *s, int t) {
  for (int i = 0; i < lim; i++)
    if (rev[i] < i) swap(s[i], s[rev[i]]);
  for (int mid = 1; mid < lim; mid = mid << 1) {
    comple wn(cos(pi / mid), sin(pi / mid) * t);
    for (int i = 0, r = mid << 1; i < lim; i += r) {
      comple w(1, 0);
      for (int j = 0; j < mid; j++, w = w * wn) {
        comple a = s[i + j], b = s[i + j + mid] * w;
        s[i + j] = a + b, s[i + j + mid] = a - b;
      }
    }
  }
}
inline void mul(vector<int> &a, vector<int> &b, vector<int> &c) {
  int lena = a.size(), lenb = b.size();
  lim = 1, k = 0;
  while (lim < lena + lenb) lim = lim << 1, k++;
  a.resize(lim), b.resize(lim), c.resize(lena + lenb - 1);
  for (int i = 0; i < lim; i++)
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (k - 1));
  for (int i = 0; i < lim; i++)
    ansa[i].b = 0, ansb[i].b = 0, ansc[i].b = 0, ansd[i].b = 0;
  for (int i = 0; i < lim; i++)
    ansa[i].a = (a[i] & 32767), ansb[i].a = (b[i] & 32767),
    ansc[i].a = a[i] >> 15, ansd[i].a = b[i] >> 15;
  FFT(ansa, 1), FFT(ansb, 1), FFT(ansc, 1), FFT(ansd, 1);
  for (int i = 0; i < lim; i++)
    anse[i] = ansa[i] * ansd[i] + ansb[i] * ansc[i],
    ansf[i] = ansa[i] * ansb[i], ansg[i] = ansc[i] * ansd[i];
  FFT(anse, -1), FFT(ansf, -1), FFT(ansg, -1);
  for (int i = 0; i < lena + lenb - 1; i++) {
    long long wa = anse[i].a / lim + 0.5, wb = ansf[i].a / lim + 0.5,
              wc = ansg[i].a / lim + 0.5;
    wa %= p, wb %= p, wc %= p;
    c[i] = (wa * (1 << 15) + wb + wc * (1 << 30)) % p;
  }
  a.resize(lena), b.resize(lenb);
}
inline void getans(int n, int k) {
  vector<int> u, w, h, c;
  u.resize(k + 1), w.resize(k + 1), h.resize(k + 1), fac[0] = ifac[0] = 1,
                                                     w[0] = 1;
  int cnt = 0;
  for (int i = 1; i <= k; i++)
    fac[i] = 1ll * fac[i - 1] * i % p, ifac[i] = pows(fac[i], p - 2);
  for (int i = 1; i <= k; i++) u[i] = ifac[i];
  int t = n, og = 1;
  while (t > 0) {
    if (t & 1) {
      int x = pows(2, cnt), g = pows(2, cnt);
      for (int i = 1; i <= k; i++)
        h[i] = 1ll * u[i] * g % p, g = 1ll * g * x % p;
      mul(w, h, c);
      for (int i = 0; i <= k; i++) w[i] = c[i];
      cnt += og;
    }
    t = t >> 1;
    if (!t) break;
    int x = pows(2, og), g = pows(2, og);
    for (int i = 1; i <= k; i++) h[i] = 1ll * u[i] * g % p, g = 1ll * g * x % p;
    mul(u, h, c);
    for (int i = 1; i <= k; i++) u[i] = c[i];
    og = og << 1;
  }
  for (int i = 1; i <= k; i++) f[i] = w[i];
}
int main() {
  long long n, q;
  cin >> n >> q;
  if (n > q) {
    cout << 0 << endl;
    return 0;
  }
  getans(n, q);
  long long sum = 0;
  for (int i = 1; i <= q; i++)
    sum = (sum + 1ll * fac[q] * ifac[q - i] % p * f[i]) % p;
  cout << sum << endl;
  return 0;
}
