#include <bits/stdc++.h>
using namespace std;
string A, B;
int lcp[100010], mk[100010];
long long prefA[100010], prefB[100010], prefC[100010], dp[100010], nt[100010];
void callcp() {
  int i = 1, j = 0;
  while (i < A.length()) {
    if (A[i] == A[j]) {
      lcp[i] = j + 1;
      j++;
      i++;
    } else {
      if (!j) {
        lcp[i] = 0;
        i++;
      } else {
        j = lcp[j - 1];
      }
    }
  }
  for (int i = A.length(); i > 0; i--) lcp[i] = lcp[i - 1];
  lcp[0] = -1;
}
void kmp() {
  int i = 0, j = 0;
  while (i < B.length()) {
    while (A[j] != B[i] && j != -1) {
      j = lcp[j];
    }
    j++;
    if (j == A.length()) {
      mk[i - j + 1] = 1;
      j = lcp[j];
    }
    i++;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> B >> A;
  callcp();
  kmp();
  int cur = -200010;
  dp[B.length()] = 1;
  prefA[B.length()] = 1;
  prefB[B.length()] = 1;
  prefC[B.length()] = 1;
  for (int i = (int)B.length() - 1; i >= 0; i--) {
    if (mk[i]) cur = i;
    nt[i] = cur + A.length();
  }
  for (int i = (int)B.length() - 1; i >= 0; i--) {
    if (nt[i] < 0)
      dp[i] = 0;
    else
      dp[i] = prefB[nt[i]];
    prefA[i] = (dp[i] + prefA[i + 1]) % 1000000007;
    prefB[i] = (prefB[i + 1] + prefA[i]) % 1000000007;
  }
  long long ans = 0;
  for (int i = 0; i < B.length(); i++) {
    ans = (ans + dp[i]) % 1000000007;
  }
  cout << ans << '\n';
}
