#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
const long long nmax = 220000;
long long sum[nmax];
long long p[nmax];
long long d[nmax];
vector<long long> vh;
string s, t;
long long n, m;
void kmp() {
  t += "$";
  t += s;
  p[0] = 0;
  for (long long i = 1; i < t.length(); i++) {
    long long v = p[i - 1];
    while ((v > 0) && (t[v] != t[i])) v = p[v - 1];
    if (t[i] == t[v]) v++;
    p[i] = v;
  }
  for (long long i = m + 1; i <= n + m; i++)
    if (p[i] == m) vh.push_back(i);
}
void solve() {
  d[0] = 0;
  sum[0] = 0;
  long long last = m - 1;
  for (long long i = 1; i <= n; i++) {
    d[i] = d[i - 1] * 2;
    if (i > 1) d[i] -= d[i - 2];
    if (d[i] < 0) {
      long long x = abs(d[i]) / mod;
      d[i] += mod * (x + 1);
    }
    d[i] %= mod;
    if (p[i + m] == m) {
      d[i] += sum[i - m] - sum[last - m] + i - last;
      if (d[i] < 0) {
        long long x = abs(d[i]) / mod;
        d[i] += mod * (x + 1);
      }
      d[i] %= mod;
      last = i;
    }
    sum[i] = (sum[i - 1] + d[i]) % mod;
  }
  cout << d[n] << endl;
}
int main() {
  cin >> s;
  n = s.length();
  cin >> t;
  m = t.length();
  kmp();
  solve();
  return 0;
}
