#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 20, inf = 2e9 + 20, mod = 1e9 + 7;
const string YN[] = {"NO", "YES"};
string s, t;
int f[maxn], mark[maxn], dp[maxn], ps[maxn], ps2[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s >> t;
  int tmp = 0;
  for (int i = 0; i < t.size(); ++i) {
    while (tmp && t[i] != t[tmp]) tmp = f[tmp - 1];
    if (i && t[i] == t[tmp]) tmp++;
    f[i] = tmp;
  }
  tmp = 0;
  for (int i = 0; i < s.size(); ++i) {
    while (tmp && s[i] != t[tmp]) tmp = f[tmp - 1];
    if (s[i] == t[tmp]) tmp++;
    if (tmp == ((int)(t).size())) mark[i + 1] = 1;
  }
  int m = ((int)(t).size());
  s = "#" + s;
  for (int i = 0; i < s.size(); ++i) {
    if (!i) continue;
    if (mark[i]) {
      dp[i] = (ps2[i - m] + i - m + 1) % mod;
    } else
      dp[i] = dp[i - 1];
    ps[i] = (ps[i - 1] + dp[i]) % mod;
    ps2[i] = (ps2[i - 1] + ps[i]) % mod;
  }
  cout << ps[((int)(s).size()) - 1];
  cout << endl;
  exit(0);
  ;
}
