#include <bits/stdc++.h>
using namespace std;
long long A[100010], B[100010], dp[100010], p[100010];
int main() {
  ios::sync_with_stdio(false);
  long long T, i, j, flag, index, mod = 1000000007;
  {
    string S, R;
    cin >> S >> R;
    long long SL = S.size(), RL = R.size();
    flag = 0;
    for (i = 1; i < RL; i++) {
      while (flag && R[i] != R[flag]) flag = A[flag];
      if (R[i] == R[flag]) flag++;
      A[i + 1] = flag;
    }
    flag = 0;
    for (j = 0; j < SL; j++) {
      while (flag && R[flag] != S[j]) flag = A[flag];
      if (R[flag] == S[j]) flag++;
      B[j] = flag;
      if (flag == RL) flag = A[flag];
    }
    index = -1;
    for (i = 0; i < SL; i++) {
      dp[i + 1] = dp[i];
      if (B[i] == RL) index = i + 1 - RL;
      if (index >= 0) dp[i + 1] += p[index] + index + 1;
      dp[i + 1] %= mod;
      p[i + 1] = (p[i] + dp[i + 1]) % mod;
    }
    cout << dp[SL] << "\n";
  }
  return 0;
}
