#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
int n, m, f[100001], ans, a[100001], b[100001];
string s, t;
bool v[100001];
void CPF() {
  int k = 0;
  f[0] = -1;
  f[1] = 0;
  for (int i = 2; i <= m; i++) {
    while (k > 0 && t[k] != t[i - 1]) k = f[k];
    if (t[k] == t[i - 1]) k++;
    f[i] = k;
  }
}
void KMP() {
  CPF();
  int q = 0;
  for (int i = 0; i < n; i++) {
    while (q > 0 && t[q] != s[i]) q = f[q];
    if (t[q] == s[i]) q++;
    if (q == m) v[i - m + 1] = 1;
  }
}
int main() {
  getline(cin, s);
  getline(cin, t);
  n = s.length();
  m = t.length();
  KMP();
  int last = -1;
  a[0] = 1;
  b[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (i >= m && v[i - m]) last = i - m;
    a[i] = a[i - 1];
    if (last != -1) a[i] = (a[i] + b[last]) % 1000000007;
    b[i] = (b[i - 1] + a[i]) % 1000000007;
  }
  ans = (a[n] - 1 + 1000000007) % 1000000007;
  cout << ans;
  return 0;
}
