#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T maxer(T &a, T b) {
  a = max(a, b);
}
template <typename T>
inline T miner(T &a, T b) {
  a = min(a, b);
}
void iOS() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void fin() { freopen("in", "r", stdin); }
void fout() { freopen("out", "w", stdout); }
const int inf = ~0u / 10;
const long long linf = ~0ull / 2;
const int maxn = 1e5 + 20, base = 709, mod = 1e9 + 7;
long long h[maxn], b[maxn], dp[maxn], hp, sum[maxn];
bool g[maxn];
long long subh(int l, int r) { return h[r] - (h[l] * b[r - l]); }
int main() {
  iOS();
  string s, t;
  cin >> s >> t;
  b[0] = 1;
  for (int i = 1; i < maxn; i++) b[i] = b[i - 1] * base;
  for (int i = 1; i <= s.size(); i++) h[i] = h[i - 1] * base + s[i - 1];
  for (int i = 0; i < t.size(); i++) hp = hp * base + t[i];
  for (int i = t.size(); i <= s.size(); i++)
    if (subh(i - t.size(), i) == hp) g[i - t.size()] = 1;
  int last = -1;
  for (int i = s.size() - 1; i >= 0; i--) {
    long long tmp = 0;
    if (g[i]) last = i;
    if (last != -1)
      tmp = (sum[last + t.size()] + s.size() - last - t.size() + 1) % mod;
    dp[i] = (dp[i + 1] + tmp) % mod;
    sum[i] = (sum[i + 1] + dp[i]) % mod;
  }
  cout << dp[0];
  return 0;
}
