#include <bits/stdc++.h>
using namespace std;
const int N = 100005, MOD = 1e9 + 7;
long long int n, m, dp[1000000], q[10000000], f[10000000];
string s, t;
int main() {
  memset(dp, 0, sizeof(dp));
  memset(f, 0, sizeof(f));
  memset(q, 0, sizeof(q));
  cin >> s >> t;
  n = s.size(), m = t.size();
  for (int i = m; i <= n; i++) {
    if (s.substr(i - m, m) == t)
      dp[i] = q[i - m] + i - m + 1;
    else
      dp[i] = dp[i - 1];
    f[i] = (f[i - 1] % MOD + dp[i] % MOD) % MOD;
    q[i] = (q[i - 1] % MOD + f[i] % MOD) % MOD;
  }
  cout << f[n] % MOD;
  return 0;
}
