#include <bits/stdc++.h>
using namespace std;
char in[100001];
char S[200003], T[200003];
int N, M;
const unsigned long long P = 100000007;
bool can[200003];
int dp[200003][3];
int main() {
  scanf("%s", &in);
  int n = strlen(in);
  S[N++] = '#';
  for (int(i) = 0; (i) < (n); (i)++) S[N++] = in[i], S[N++] = '#';
  scanf("%s", &in);
  n = strlen(in);
  for (int(i) = 0; (i) < (n); (i)++) T[M++] = in[i], T[M++] = '#';
  M--;
  unsigned long long t = 0;
  for (int(i) = 0; (i) < (M); (i)++) t = t * P + T[i];
  unsigned long long pw = 1;
  for (int(i) = 0; (i) < (M); (i)++) pw *= P;
  unsigned long long h = 0;
  for (int(i) = 0; (i) < (N); (i)++) {
    h = h * P + S[i];
    if (i >= M) h -= pw * S[i - M];
    if (i >= M - 1 && h == t) can[i - M + 1] = true;
  }
  dp[0][0] = 1;
  for (int(i) = 0; (i) < (N); (i)++) {
    if (i % 2 == 1) {
      if (can[i]) {
        dp[i + M][2] = (dp[i + M][2] + dp[i][0]) % 1000000007;
        dp[i + M][2] = (dp[i + M][2] + dp[i][1]) % 1000000007;
        dp[i + 1][2] = (dp[i + 1][2] + dp[i][2]) % 1000000007;
        dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % 1000000007;
      } else {
        dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % 1000000007;
        dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % 1000000007;
        dp[i + 1][2] = (dp[i + 1][2] + dp[i][2]) % 1000000007;
        dp[i + 1][1] = (dp[i + 1][1] + dp[i][0]) % 1000000007;
      }
    } else {
      dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % 1000000007;
      dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % 1000000007;
      dp[i + 1][2] = (dp[i + 1][2] + dp[i][2]) % 1000000007;
      dp[i + 1][0] = (dp[i + 1][0] + dp[i][2]) % 1000000007;
    }
  }
  dp[N][0] = (dp[N][0] + 1000000007 - 1) % 1000000007;
  printf("%d\n", dp[N][0]);
}
