#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int M = 1e9 + 7;
string s, t, f;
int calc[N], p[N], d[N], m, n, k;
void kmp() {
  f = t + "#" + s;
  n = f.size();
  m = t.size();
  k = s.size();
  for (int i = 1; i < n; i++) {
    int j = p[i - 1];
    while (j > 0 && f[i] != f[j]) j = p[j - 1];
    if (f[i] == f[j]) j++;
    p[i] = j;
  }
}
int main() {
  cin >> s >> t;
  kmp();
  int last = -1;
  for (int i = m; i < n; i++) {
    d[i] = d[i - 1];
    if (p[i] == m) last = i - m;
    if (last != -1) d[i] = (d[i] + last - m + 1 + calc[last]) % M;
    calc[i] = calc[i - 1] + d[i];
    calc[i] %= M;
  }
  cout << d[n - 1];
  return 0;
}
