#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int tmpA[20][30001];
int tmpB[20][30001];
int tmpC[20][30001];
int tmpD[20][30001];
int tmpE[20][30001];
unsigned long long tmpsD[40], tmpsE[40];
void multiply2(const int* const& A, const int* const& B, const int* const& C,
               int* const& D, int* const& E, int const& len, int const& id) {
  if (len < 19) {
    for (int i = 1; i <= (len); ++i)
      for (int j = 1; j <= (len); ++j) {
        tmpsD[i + j] += (long long)A[i] * C[j];
        tmpsE[i + j] += (long long)B[i] * C[j];
      }
    for (int i = 1; i <= (len * 2); ++i) {
      D[i] = tmpsD[i] % mod;
      tmpsD[i] = 0;
      E[i] = tmpsE[i] % mod;
      tmpsE[i] = 0;
    }
    return;
  }
  int halflen = len >> 1, halflen2 = len - halflen;
  const int* const AA = A + halflen;
  const int* const BB = B + halflen;
  const int* const CC = C + halflen;
  int* const DD = D + halflen + halflen;
  int* const EE = E + halflen + halflen;
  multiply2(A, B, C, D, E, halflen, id);
  multiply2(AA, BB, CC, DD, EE, halflen2, id);
  int* const NA = tmpA[id];
  int* const NB = tmpB[id];
  int* const NC = tmpC[id];
  int* const ND = tmpD[id];
  int* const NE = tmpE[id];
  for (int i = 1; i <= (halflen); ++i) {
    NA[i] = A[i];
    if ((NA[i] += AA[i]) >= mod) NA[i] -= mod;
    NB[i] = B[i];
    if ((NB[i] += BB[i]) >= mod) NB[i] -= mod;
    NC[i] = C[i];
    if ((NC[i] += CC[i]) >= mod) NC[i] -= mod;
  }
  if (halflen2 != halflen) {
    NA[halflen2] = AA[halflen2];
    NB[halflen2] = BB[halflen2];
    NC[halflen2] = CC[halflen2];
  }
  multiply2(NA, NB, NC, ND, NE, halflen2, id + 1);
  for (int i = 1; i <= (halflen * 2); ++i) {
    if ((ND[i] += mod - D[i]) >= mod) ND[i] -= mod;
    if ((ND[i] += mod - DD[i]) >= mod) ND[i] -= mod;
    if ((NE[i] += mod - E[i]) >= mod) NE[i] -= mod;
    if ((NE[i] += mod - EE[i]) >= mod) NE[i] -= mod;
  }
  if (halflen2 != halflen) {
    if ((ND[halflen2 * 2 - 1] += mod - DD[halflen2 * 2 - 1]) >= mod)
      ND[halflen2 * 2 - 1] -= mod;
    if ((ND[halflen2 * 2] += mod - DD[halflen2 * 2]) >= mod)
      ND[halflen2 * 2] -= mod;
    if ((NE[halflen2 * 2 - 1] += mod - EE[halflen2 * 2 - 1]) >= mod)
      NE[halflen2 * 2 - 1] -= mod;
    if ((NE[halflen2 * 2] += mod - EE[halflen2 * 2]) >= mod)
      NE[halflen2 * 2] -= mod;
  }
  for (int i = 1; i <= (halflen2 * 2); ++i) {
    if ((D[i + halflen] += ND[i]) >= mod) D[i + halflen] -= mod;
    if ((E[i + halflen] += NE[i]) >= mod) E[i + halflen] -= mod;
    ND[i] = NE[i] = 0;
  }
}
void multiply(const int* const& A, const int* const& B, int* const& D,
              int const& len, int const& id) {
  if (len < 19) {
    for (int i = 1; i <= (len); ++i)
      for (int j = 1; j <= (len); ++j) {
        tmpsD[i + j] += (long long)A[i] * B[j];
      }
    for (int i = 1; i <= (len * 2); ++i) {
      D[i] = tmpsD[i] % mod;
      tmpsD[i] = 0;
    }
    return;
  }
  int halflen = len >> 1, halflen2 = len - halflen;
  const int* const AA = A + halflen;
  const int* const BB = B + halflen;
  int* const DD = D + halflen + halflen;
  multiply(A, B, D, halflen, id);
  multiply(AA, BB, DD, halflen2, id);
  int* const NA = tmpA[id];
  int* const NB = tmpB[id];
  int* const ND = tmpD[id];
  for (int i = 1; i <= (halflen); ++i) {
    NA[i] = A[i];
    if ((NA[i] += AA[i]) >= mod) NA[i] -= mod;
    NB[i] = B[i];
    if ((NB[i] += BB[i]) >= mod) NB[i] -= mod;
  }
  if (halflen2 != halflen) {
    NA[halflen2] = AA[halflen2];
    NB[halflen2] = BB[halflen2];
  }
  multiply(NA, NB, ND, halflen2, id + 1);
  for (int i = 1; i <= (halflen * 2); ++i) {
    if ((ND[i] += mod - D[i]) >= mod) ND[i] -= mod;
    if ((ND[i] += mod - DD[i]) >= mod) ND[i] -= mod;
  }
  if (halflen2 != halflen) {
    if ((ND[halflen2 * 2 - 1] += mod - DD[halflen2 * 2 - 1]) >= mod)
      ND[halflen2 * 2 - 1] -= mod;
    if ((ND[halflen2 * 2] += mod - DD[halflen2 * 2]) >= mod)
      ND[halflen2 * 2] -= mod;
  }
  for (int i = 1; i <= (halflen2 * 2); ++i) {
    if ((D[i + halflen] += ND[i]) >= mod) D[i + halflen] -= mod;
    ND[i] = 0;
  }
}
int polyA[60001];
int polyB[60001];
int polyC[60001];
int polyD[70001];
int polyE[70001];
long long N, K;
long long fact[30001];
long long invfact[30001];
long long inv[30001];
int main() {
  fact[0] = invfact[0] = 1;
  for (int i = 1; i <= (30000); ++i) {
    fact[i] = fact[i - 1] * i % mod;
    inv[i] = i == 1 ? 1LL : mod - mod / i * inv[mod % i] % mod;
    invfact[i] = invfact[i - 1] * inv[i] % mod;
  }
  cin >> N >> K;
  if (N > K) {
    printf("0\n");
    return 0;
  }
  long long NP = 2;
  for (int i = 1; i <= (K); ++i) polyA[i] = polyB[i] = 1;
  --N;
  int preZero = 0;
  for (int msk = 1; msk <= N; msk <<= 1) {
    for (int i = 1; i <= (K); ++i) {
      polyC[i] = polyB[i] * invfact[i] % mod;
    }
    if (N & msk) {
      register long long NPP = NP;
      for (int i = 1; i <= (K); ++i) {
        polyA[i] = polyA[i] * NPP % mod * invfact[i] % mod;
        polyB[i] = polyC[i] * NPP % mod;
        NPP = NPP * NP % mod;
      }
      multiply2(polyA + preZero, polyB + msk - 1, polyC + msk - 1,
                polyD + preZero + msk - 1, polyE + msk * 2 - 2,
                K - preZero - msk + 1, 0);
      for (int i = 1; i <= (K); ++i) {
        polyA[i] = polyD[i] * fact[i] % mod;
        polyD[i] = polyD[K + i] = 0;
        polyB[i] = polyE[i] * fact[i] % mod;
        polyE[i] = polyE[K + i] = 0;
      }
      preZero += msk;
    } else {
      register long long NPP = NP;
      for (int i = 1; i <= (K); ++i) {
        polyB[i] = polyC[i] * NPP % mod;
        NPP = NPP * NP % mod;
      }
      multiply(polyB + msk - 1, polyC + msk - 1, polyE + 2 * msk - 2,
               K - 2 * msk + 2, 0);
      for (int i = 1; i <= (K); ++i) {
        polyB[i] = polyE[i] * fact[i] % mod;
        polyE[i] = polyE[K + i] = 0;
      }
    }
    NP = NP * NP % mod;
  }
  long long ans = 0;
  for (int i = (N); i <= (K); ++i) {
    ans = (ans + polyA[i] * invfact[i] % mod * invfact[K - i]) % mod;
  }
  cout << ans * fact[K] % mod << endl;
  cin >> N;
  return 0;
}
