#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5;
long long DP[3][MAXN + 5];
vector<int> prefix(string &S) {
  vector<int> p(S.size());
  p[0] = 0;
  for (int i = 1; i < S.size(); ++i) {
    p[i] = p[i - 1];
    while (p[i] > 0 && S[p[i]] != S[i]) p[i] = p[p[i] - 1];
    if (S[p[i]] == S[i]) p[i]++;
  }
  return p;
}
long long KMP(string &P, vector<int> &pi, string &S) {
  int n = S.length(), m = P.length();
  DP[0][0] = DP[1][0] = DP[2][0] = 1;
  int j = 0, r = -1;
  for (int i = 1; i <= n; ++i) {
    while (j > 0 && S[i - 1] != P[j]) j = pi[j - 1];
    if (S[i - 1] == P[j]) ++j;
    if (j == P.length()) {
      r = i - P.length() + 1;
      j = pi[j - 1];
    }
    if (r != -1)
      DP[0][i] = DP[2][r - 1];
    else
      DP[0][i] = 0;
    DP[1][i] = (DP[1][i - 1] + DP[0][i]) % MOD;
    DP[2][i] = (DP[2][i - 1] + DP[1][i]) % MOD;
  }
  return (DP[1][n] + MOD - 1) % MOD;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string S, T;
  cin >> S >> T;
  vector<int> pi = prefix(T);
  cout << KMP(T, pi, S) << '\n';
  return 0;
}
