#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
constexpr ll mod = 1e9 + 7;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  friend ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
  friend istream& operator>>(istream& is, mint& a) {
    ll t;
    is >> t;
    a = mint(t);
    return (is);
  }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
  bool operator==(const mint a) const { return x == a.x; }
};
vec<int> KMP(string S) {
  int M = S.size();
  vec<int> kmp(M + 1, 0);
  int i = 0, j = kmp[0] = -1;
  while (i < M) {
    while (j > -1 && S[i] != S[j]) j = kmp[j];
    i++;
    j++;
    if (S[i] == S[j])
      kmp[i] = kmp[j];
    else
      kmp[i] = j;
  }
  return kmp;
}
int calcne(string& S, vec<int>& kmpnext, int pos, char c) {
  while (pos > -1 && c != S[pos]) pos = kmpnext[pos];
  return pos + 1;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S, T;
  cin >> S >> T;
  int N = S.size(), M = T.size();
  vec<int> ok(N);
  vec<int> kmp = KMP(T);
  int p = 0;
  for (int i = 0; i < N; i++) {
    p = calcne(T, kmp, p, S[i]);
    if (p == M) ok[i] = 1;
  }
  vec<int> last(N + 1, N);
  for (int i = 0; i < N; i++) {
    if (ok[i])
      last[i + 1] = i;
    else
      last[i + 1] = last[i];
  }
  vec<mint> dp(N + 1), sum(N + 1, 1);
  dp[0] = 1;
  for (int i = 0; i < N; i++) {
    dp[i + 1] += dp[i];
    if (last[i + 1] != N) {
      dp[i + 1] += sum[last[i + 1] - M + 1];
    }
    sum[i + 1] = sum[i] + dp[i + 1];
  }
  cout << dp[N] - 1 << "\n";
}
